From 4a9d6d1fe98439df3f3b80b800d36b8b9cefafcf Mon Sep 17 00:00:00 2001 From: "\"Vladimir N. Oleynik\"" Date: Tue, 13 Dec 2005 08:44:41 +0000 Subject: remove strange bloat dup2() usage, sync this code with mainstream login-utils, size reduce --- loginutils/getty.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'loginutils/getty.c') 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) /* 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 { /* -- cgit v1.2.3