initial import
[patches.git] / telnetd-ptmx.patch
CommitLineData
5e993f12 1Index: user/telnetd/sys_term.c
2===================================================================
3RCS file: /usr/local/src/blackfin/rsync/uclinux533/uClinux-dist/user/telnetd/sys_term.c,v
4retrieving revision 1.2
5diff -u -p -r1.2 sys_term.c
6--- user/telnetd/sys_term.c 25 Jul 2005 06:44:04 -0000 1.2
7+++ user/telnetd/sys_term.c 9 Sep 2006 03:36:52 -0000
8@@ -453,6 +453,27 @@ int getpty(void) {
9 int p;
10 #ifndef CRAY
11
12+#ifdef USE_PTMX
13+ char *pts;
14+ int ptm = open("/dev/ptmx", O_RDWR | O_NOCTTY);
15+ if (ptm < 0)
16+ fatalperror(net, "Could not open /dev/ptmx");
17+ if (grantpt(ptm) < 0)
18+ fatalperror(net, "Could not grantpt(/dev/ptmx)");
19+ if (unlockpt(ptm) < 0)
20+ fatalperror(net, "Could not unlockpt(/dev/ptmx)");
21+ pts = ptsname(ptm);
22+ if (pts == NULL)
23+ fatalperror(net, "Could not get ptsname()");
24+ free(line);
25+ line = strdup(pts);
26+ ptyslavefd = open(pts, O_RDWR | O_NOCTTY);
27+ if (ptyslavefd < 0)
28+ fatalperror(net, "Could not open slave pty");
29+
30+ return ptm;
31+#else
32+
33 #ifndef DEVFS
34 char *p1, *p2;
35 int i,j;
36@@ -502,6 +523,8 @@ int getpty(void) {
37
38 #endif /* DEVFS */
39
40+#endif /* PTMX */
41+
42 #else /* CRAY */
43 int npty;
44 extern lowpty, highpty;