summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 23fccc7)
raw | patch | inline | side by side (parent: 23fccc7)
author | Florian Forster <octo@crystal.wlan.home.verplant.org> | |
Wed, 9 Apr 2008 16:32:14 +0000 (18:32 +0200) | ||
committer | Florian Forster <octo@crystal.wlan.home.verplant.org> | |
Wed, 9 Apr 2008 16:32:14 +0000 (18:32 +0200) |
src/exec.c | patch | blob | history |
diff --git a/src/exec.c b/src/exec.c
index 0ab259dcbb277031a4a4b26d9ed225fa46e85ed3..52dd831db7f4f773b18e495f74836ed88d06c24b 100644 (file)
--- a/src/exec.c
+++ b/src/exec.c
}
else if (pl->pid == 0)
{
- close (fd_pipe[0]);
+ int fd_num;
+ int fd;
+
+ /* Close all file descriptors but the pipe end we need. */
+ fd_num = getdtablesize ();
+ for (fd = 0; fd < fd_num; fd++)
+ {
+ if (fd == fd_pipe[1])
+ continue;
+ close (fd);
+ }
/* Connect the pipe to STDOUT and STDERR */
if (fd_pipe[1] != STDOUT_FILENO)