[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: [BusyBox] telnetd pyts for vanilla devfs
From: David Updegraff <dave () cray ! com>
Date: 2003-10-28 21:50:34
[Download RAW message or body]
Hi.
Enclosed is very convenient patch for telnetd that permits it to work
properly with devfs when there is no devfsd compatibility layer.
Given typically RO embedded/flash root filesystems, seems devfsd-less
approach might be more usefull. At least it is to us.
Cheers.
--
Dave Updegraff / dave@cray.com
["telnetd.patch" (text/plain)]
Index: networking/telnetd.c
===================================================================
RCS file: /var/cvs/busybox/networking/telnetd.c,v
retrieving revision 1.8
diff -u -r1.8 telnetd.c
--- networking/telnetd.c 12 Sep 2003 11:27:15 -0000 1.8
+++ networking/telnetd.c 28 Oct 2003 21:48:31 -0000
@@ -44,8 +44,13 @@
#include <ctype.h>
#include <sys/syslog.h>
+
#include "busybox.h"
+#if defined(CONFIG_FEATURE_DEVFS) && !defined(CONFIG_DEVFSD)
+#include <dirent.h>
+#endif
+
#define BUFSIZE 4000
static const char *loginpath
@@ -176,6 +181,30 @@
}
#else
struct stat stb;
+
+#if defined(CONFIG_FEATURE_DEVFS) && !defined(CONFIG_DEVFSD)
+ struct dirent *pty_ent;
+ DIR *pty_dir;
+
+ /* if devfsd is not running, then these are below this dir */
+ if ((pty_dir = opendir ("/dev/pty"))) {
+ while ((pty_ent = readdir (pty_dir))) {
+ sprintf (line,"/dev/pty/%s", pty_ent->d_name);
+ /* the m* ones are conventinally masters, s* slaves */
+ if (line[9] == 'm')
+ {
+ if ((p = open(line, O_RDWR | O_NOCTTY)) >= 0) {
+ line[9] = 's';
+ if (stat(line, &stb) < 0)
+ continue;
+ closedir (pty_dir);
+ return p;
+ }
+ }
+ }
+ closedir (pty_dir);
+ }
+#else
int i;
int j;
@@ -195,6 +224,8 @@
}
}
}
+#endif /* defined(CONFIG_FEATURE_DEVFS) && !defined(CONFIG_DEVFSD) */
+
#endif /* CONFIG_FEATURE_DEVPTS */
return -1;
}
_______________________________________________
busybox mailing list
busybox@mail.busybox.net
http://codepoet.org/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic