From 1ce27010dd060508f349aa25a57f18f61edc0c7b Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Mon, 31 Aug 2015 12:51:25 +0100 Subject: [PATCH] Add a new #define to disable pty_pre_init. 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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/unix/uxpty.c b/unix/uxpty.c index 38f99de4..1d803ab1 100644 --- a/unix/uxpty.c +++ b/unix/uxpty.c @@ -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) -- 2.45.2