From: Todd C. Miller Date: Thu, 7 Oct 1999 21:13:45 +0000 (+0000) Subject: add O_NOCTTY when opening /dev/tty just in case X-Git-Tag: SUDO_1_6_0~49 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cc82693f58632672aa790ae3c6d0a4b18923e42b;p=sudo add O_NOCTTY when opening /dev/tty just in case --- diff --git a/tgetpass.c b/tgetpass.c index 9a169c2bc..7329f6402 100644 --- a/tgetpass.c +++ b/tgetpass.c @@ -77,6 +77,10 @@ #define TCSASOFT 0 #endif /* TCSASOFT */ +#ifndef O_NOCTTY +#define O_NOCTTY 0 +#endif /* O_NOCTTY */ + #ifndef lint static const char rcsid[] = "$Sudo$"; #endif /* lint */ @@ -106,7 +110,7 @@ tgetpass(prompt, timeout, echo_off) struct timeval tv; /* Open /dev/tty for reading/writing if possible else use stdin/stderr. */ - if ((input = output = open(_PATH_TTY, O_RDWR)) == -1) { + if ((input = output = open(_PATH_TTY, O_RDWR|O_NOCTTY)) == -1) { input = STDIN_FILENO; output = STDERR_FILENO; }