From: "Vladimir N. Oleynik" Date: Tue, 13 Dec 2005 08:44:41 +0000 (-0000) Subject: remove strange bloat dup2() usage, sync this code with mainstream login-utils, size... X-Git-Tag: 1_1_0~423 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4a9d6d1fe98439df3f3b80b800d36b8b9cefafcf;p=oweals%2Fbusybox.git remove strange bloat dup2() usage, sync this code with mainstream login-utils, size reduce --- 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 { /*