projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
(from parent 1:
2fe27dc
)
Merge branch 'collectd-4.3'
author
Florian Forster
<octo@crystal.wlan.home.verplant.org>
Wed, 9 Apr 2008 16:45:38 +0000
(18:45 +0200)
committer
Florian Forster
<octo@crystal.wlan.home.verplant.org>
Wed, 9 Apr 2008 16:45:38 +0000
(18:45 +0200)
Conflicts:
src/exec.c
src/exec.c
patch
|
blob
|
history
diff --git
a/src/exec.c
b/src/exec.c
index
70c1c18
..
07c35c9
100644
(file)
--- a/
src/exec.c
+++ b/
src/exec.c
@@
-429,9
+429,19
@@
static int fork_child (program_list_t *pl, int *fd_in, int *fd_out, int *fd_err)
}
else if (pid == 0)
{
- close (fd_pipe_in[1]);
- close (fd_pipe_out[0]);
- close (fd_pipe_err[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_in[0])
+ || (fd == fd_pipe_out[1])
+ || (fd == fd_pipe_err[1]))
+ continue;
+ close (fd);
+ }
/* Connect the `in' pipe to STDIN */
if (fd_pipe_in[0] != STDIN_FILENO)