aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--loginutils/getty.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/loginutils/getty.c b/loginutils/getty.c
index e8643ef93..1cfbd6734 100644
--- a/loginutils/getty.c
+++ b/loginutils/getty.c
@@ -528,12 +528,11 @@ static void open_tty(char *tty, struct termio *tp, int local)
528 528
529 /* Open the tty as standard input. */ 529 /* Open the tty as standard input. */
530 530
531 close(0);
531 debug("open(2)\n"); 532 debug("open(2)\n");
532 fd = open(tty, O_RDWR | O_NONBLOCK, 0); 533 fd = open(tty, O_RDWR | O_NONBLOCK, 0);
533 if (dup2(fd, STDIN_FILENO) == -1) 534 if (fd != 0)
534 error("/dev/%s: cannot open as standard input: %m", tty); 535 error("/dev/%s: cannot open as standard input: %m", tty);
535 close(fd);
536
537 } else { 536 } else {
538 537
539 /* 538 /*