svr4 ptys because of /dev/ptmx, but erroneously wants <sys/stropts.h> because of that define. Fix properly, by detecting the presense of <sys/stropts.h> before including it. I am not bumping the nb number because nothing realy changes; you'll get the same binary if you recompile. XXX: The utmp stuff is still completely broken, that is why this is still setuid.
59 lines
1.1 KiB
Text
59 lines
1.1 KiB
Text
$NetBSD: patch-aa,v 1.10 2004/06/16 21:35:00 christos Exp $
|
|
|
|
--- pty.c.orig 2003-09-08 10:26:18.000000000 -0400
|
|
+++ pty.c 2004-06-16 17:28:12.000000000 -0400
|
|
@@ -34,7 +34,7 @@
|
|
#endif
|
|
|
|
/* for solaris 2.1, Unixware (SVR4.2) and possibly others */
|
|
-#ifdef HAVE_SVR4_PTYS
|
|
+#ifdef HAVE_SYS_STROPTS_H
|
|
# include <sys/stropts.h>
|
|
#endif
|
|
|
|
@@ -332,6 +332,45 @@
|
|
|
|
/***************************************************************/
|
|
|
|
+#if defined(__NetBSD__) && !defined(PTY_DONE)
|
|
+#define PTY_DONE
|
|
+
|
|
+#include <sys/param.h>
|
|
+#include <string.h>
|
|
+
|
|
+int
|
|
+OpenPTY(ttyn)
|
|
+char **ttyn;
|
|
+{
|
|
+ int m, s, f;
|
|
+ char *t;
|
|
+
|
|
+ do
|
|
+ {
|
|
+ if (openpty(&m, &s, TtyName, NULL, NULL) < 0)
|
|
+ return -1;
|
|
+ close(m);
|
|
+ close(s);
|
|
+
|
|
+ strcpy(PtyName, TtyName);
|
|
+ t = strrchr(PtyName, '/');
|
|
+ if ((t == NULL ) || (*++t != 't'))
|
|
+ return -1;
|
|
+ *t = 'p';
|
|
+
|
|
+ f = open(PtyName, O_RDWR | O_NOCTTY);
|
|
+ }
|
|
+ while (f < 0);
|
|
+
|
|
+ initmaster(f);
|
|
+ *ttyn = TtyName;
|
|
+
|
|
+ return f;
|
|
+}
|
|
+#endif
|
|
+
|
|
+/***************************************************************/
|
|
+
|
|
#ifndef PTY_DONE
|
|
int
|
|
OpenPTY(ttyn)
|