1 From 1edd25cfa0a26dac1ca5d49bce479ebdea336437 Mon Sep 17 00:00:00 2001
2 From: Gabor Juhos <juhosg@openwrt.org>
3 Date: Fri, 19 Jul 2013 08:21:17 +0200
4 Subject: [PATCH 2/2] early: remove superfluous close of stdio file
9 dup2() makes newfd be the copy of oldfd, closing newfd first if
10 necessary, but note the following:
12 * If oldfd is not a valid file descriptor, then the call fails,
13 and newfd is not closed.
15 * If oldfd is a valid file descriptor, and newfd has the same
16 value as oldfd, then dup2() does nothing, and returns newfd.
18 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
21 1 file changed, 4 deletions(-)
23 diff --git a/early.c b/early.c
24 index 204623b..f9e3277 100644
27 @@ -53,10 +53,6 @@ static void early_console(const char *dev)
28 mkdev("*console", 0600);
30 dd = open(dev, O_RDWR);
31 - close(STDIN_FILENO);
32 - close(STDOUT_FILENO);
33 - close(STDERR_FILENO);
36 ERROR("Failed to open %s\n", dev);