]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Add a new #define to disable pty_pre_init.
authorSimon Tatham <anakin@pobox.com>
Mon, 31 Aug 2015 11:51:25 +0000 (12:51 +0100)
committerSimon Tatham <anakin@pobox.com>
Mon, 31 Aug 2015 11:51:25 +0000 (12:51 +0100)
OS X dislikes us calling the setuid or setgid syscalls when not
privileged, even if we try to set ourselves to the _same_ uid/gid.
Since I don't anticipate this code needing to run setuid on OS X, and
since I do anticipate wanting to handle multiple ptys in a single
process so that pty_pre_init would be useless anyway, the simplest fix
seems to me to be just conditioning out the whole of pty_pre_init
completely.

unix/uxpty.c

index 38f99de4169d3d76ffd592a24c7286b0464b23e7..1d803ab13c47c02888498c3fb5631175e421b2c1 100644 (file)
@@ -259,11 +259,13 @@ static void cleanup_utmp(void)
 }
 #endif
 
+#ifndef NO_PTY_PRE_INIT
 static void sigchld_handler(int signum)
 {
     if (write(pty_signal_pipe[1], "x", 1) <= 0)
        /* not much we can do about it */;
 }
+#endif
 
 #ifndef OMIT_UTMP
 static void fatal_sig_handler(int signum)
@@ -395,6 +397,8 @@ static void pty_open_master(Pty pty)
  */
 void pty_pre_init(void)
 {
+#ifndef NO_PTY_PRE_INIT
+
     Pty pty;
 
 #ifndef OMIT_UTMP
@@ -542,6 +546,9 @@ void pty_pre_init(void)
         }
 #endif
     }
+
+#endif /* NO_PTY_PRE_INIT */
+
 }
 
 int pty_real_select_result(Pty pty, int event, int status)