From 4d1539ee4f8e8e4ffe8eba4741a86c450c37ac8e Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 9 Sep 2016 17:24:25 +0200 Subject: init: use only dup2() instead of dup() dup2() is already used and linked in. No need to use dup() when the same can be achieved with dup2(). Removes 48 bytes. --- init/init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init/init.c b/init/init.c index be7dd5e..4abfb4e 100644 --- a/init/init.c +++ b/init/init.c @@ -487,11 +487,11 @@ static void reopen_console() { fd = open(dev_console, O_RDWR); // fd = 0 (stdin) or -1 (error) if (fd < 0) - dup(oldfd); // restore 0 from old console + dup2(oldfd, 0); // restore 0 from old console close(oldfd); - dup(0); // stdout - dup(0); // stderr + dup2(0, 1); // stdout + dup2(0, 2); // stderr print("init/info : reopened /dev/console\n"); } -- 1.7.12.1