From: Todd C. Miller Date: Mon, 16 May 2016 17:12:54 +0000 (-0600) Subject: Do not need to open /dev/tty with O_NONBLOCK, it doesn't block on X-Git-Tag: SUDO_1_8_17^2~52 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3b39377246ac7b799590f2270864b4c660e7ee9e;p=sudo Do not need to open /dev/tty with O_NONBLOCK, it doesn't block on first open like a physical terminal. By definition, if you have a controlling tty, the first open (which might block) has already occurred. --- diff --git a/src/sudo.c b/src/sudo.c index 2217d6ae2..d4bd688c3 100644 --- a/src/sudo.c +++ b/src/sudo.c @@ -506,7 +506,7 @@ get_user_info(struct user_details *ud) ud->ppid = getppid(); ud->pgid = getpgid(0); ud->tcpgid = -1; - fd = open(_PATH_TTY, O_RDWR|O_NOCTTY|O_NONBLOCK, 0); + fd = open(_PATH_TTY, O_RDWR|O_NOCTTY, 0); if (fd != -1) { ud->tcpgid = tcgetpgrp(fd); close(fd);