summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--early.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/early.c b/early.c
index 27d0929..204623b 100644
--- a/early.c
+++ b/early.c
@@ -65,7 +65,11 @@ static void early_console(const char *dev)
dup2(dd, STDIN_FILENO);
dup2(dd, STDOUT_FILENO);
dup2(dd, STDERR_FILENO);
- close(dd);
+
+ if (dd != STDIN_FILENO &&
+ dd != STDOUT_FILENO &&
+ dd != STDERR_FILENO)
+ close(dd);
}
static void early_env(void)