diff options
author | David Oberhollenzer <goliath@infraroot.at> | 2020-05-06 17:44:19 +0200 |
---|---|---|
committer | David Oberhollenzer <goliath@infraroot.at> | 2020-05-06 17:44:19 +0200 |
commit | 8d587b86e76817b10f86d18463fc7e536ea501ae (patch) | |
tree | afaefee26ad0264c84503aecc38bd4a843ad3450 | |
parent | 5e636bc2fca2c5520445bd21391e514e250c0708 (diff) |
Do not close stdin/out/err file descriptors in runsvc
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
-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); } |