Open controlling terminal only as stdin

This commit is contained in:
Arun Prakash Jana 2021-07-24 22:21:21 +05:30
parent 0db988b9b2
commit f1dbb9622d

View file

@ -8226,8 +8226,7 @@ int main(int argc, char *argv[])
/* We return to tty */ /* We return to tty */
if (!isatty(STDOUT_FILENO)) { if (!isatty(STDOUT_FILENO)) {
fd = open(ctermid(NULL), O_RDWR, 0400); fd = open(ctermid(NULL), O_RDONLY, 0400);
dup2(fd, STDOUT_FILENO);
dup2(fd, STDIN_FILENO); dup2(fd, STDIN_FILENO);
close(fd); close(fd);
} else } else