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:
@@ -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;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user