remove strange bloat dup2() usage, sync this code with mainstream login-utils, size reduce

This commit is contained in:
"Vladimir N. Oleynik" 2005-12-13 08:44:41 +00:00
parent 70f7ef7be3
commit 4a9d6d1fe9

View File

@ -528,12 +528,11 @@ static void open_tty(char *tty, struct termio *tp, int local)
/* Open the tty as standard input. */
close(0);
debug("open(2)\n");
fd = open(tty, O_RDWR | O_NONBLOCK, 0);
if (dup2(fd, STDIN_FILENO) == -1)
if (fd != 0)
error("/dev/%s: cannot open as standard input: %m", tty);
close(fd);
} else {
/*