O_NOCTTY has no effect when opening /dev/tty as the open can only

succeed if there is already a controlling tty.
This commit is contained in:
Todd C. Miller
2016-05-16 11:17:20 -06:00
parent 3b39377246
commit a2e541aef8
5 changed files with 6 additions and 6 deletions

View File

@@ -125,7 +125,7 @@ restart:
need_restart = 0;
/* Open /dev/tty for reading/writing if possible else use stdin/stderr. */
if (ISSET(flags, TGP_STDIN) ||
(input = output = open(_PATH_TTY, O_RDWR|O_NOCTTY)) == -1) {
(input = output = open(_PATH_TTY, O_RDWR)) == -1) {
input = STDIN_FILENO;
output = STDERR_FILENO;
}
@@ -372,7 +372,7 @@ tty_present(void)
int fd;
debug_decl(tty_present, SUDO_DEBUG_UTIL)
if ((fd = open(_PATH_TTY, O_RDWR|O_NOCTTY)) != -1)
if ((fd = open(_PATH_TTY, O_RDWR)) != -1)
close(fd);
debug_return_bool(fd != -1);
#endif