2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-09-02 15:25:58 +00:00

add O_NOCTTY when opening /dev/tty just in case

This commit is contained in:
Todd C. Miller
1999-10-07 21:13:45 +00:00
parent c832accc14
commit cc82693f58

View File

@@ -77,6 +77,10 @@
#define TCSASOFT 0 #define TCSASOFT 0
#endif /* TCSASOFT */ #endif /* TCSASOFT */
#ifndef O_NOCTTY
#define O_NOCTTY 0
#endif /* O_NOCTTY */
#ifndef lint #ifndef lint
static const char rcsid[] = "$Sudo$"; static const char rcsid[] = "$Sudo$";
#endif /* lint */ #endif /* lint */
@@ -106,7 +110,7 @@ tgetpass(prompt, timeout, echo_off)
struct timeval tv; struct timeval tv;
/* Open /dev/tty for reading/writing if possible else use stdin/stderr. */ /* 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; input = STDIN_FILENO;
output = STDERR_FILENO; output = STDERR_FILENO;
} }