aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/initlog.c1
-rw-r--r--src/process.c3
2 files changed, 3 insertions, 1 deletions
diff --git a/src/initlog.c b/src/initlog.c
index c102f082..5905e16c 100644
--- a/src/initlog.c
+++ b/src/initlog.c
@@ -180,6 +180,7 @@ int startDaemon() {
dup2(fd,0);
dup2(fd,1);
dup2(fd,2);
+ close(fd);
/* kid */
execlp("minilogd","minilogd",NULL);
perror("exec");
diff --git a/src/process.c b/src/process.c
index ce0d459d..a880791a 100644
--- a/src/process.c
+++ b/src/process.c
@@ -115,7 +115,8 @@ int forkCommand(char **args, int *outfd, int *errfd, int *cmdfd, int quiet) {
if(sc_open_max > 1) {
int fd;
for(fd = 3; fd < sc_open_max; fd++) {
- close(fd);
+ if (cmdfd && fd != CMD_FD)
+ close(fd);
}
}