diff options
-rw-r--r-- | initd/runsvc.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/initd/runsvc.c b/initd/runsvc.c index 1963a09..b30e8e3 100644 --- a/initd/runsvc.c +++ b/initd/runsvc.c @@ -70,7 +70,7 @@ static int close_all_files(void) return -1; } - for (fd = 0; fd < n; ++fd) + for (fd = STDERR_FILENO + 1; fd < n; ++fd) close(fd); } else { while ((ent = readdir(dir)) != NULL) { @@ -78,6 +78,12 @@ static int close_all_files(void) continue; fd = atoi(ent->d_name); + + if (fd == STDIN_FILENO || fd == STDOUT_FILENO || + fd == STDERR_FILENO) { + continue; + } + close(fd); } |