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
1 changed files with 1 additions and 2 deletions

View File

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