summaryrefslogtreecommitdiffstats
path: root/spawn
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-06 16:11:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-06 16:11:34 +0000
commitd079b656b4719739b2247dcd9d46e9bec793095a (patch)
treed2c950c70a776bcf697c963151c5bd959f8a9f03 /spawn
parentReleasing debian version 1.37.1-2. (diff)
downloadnetdata-d079b656b4719739b2247dcd9d46e9bec793095a.tar.xz
netdata-d079b656b4719739b2247dcd9d46e9bec793095a.zip
Merging upstream version 1.38.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'spawn')
-rw-r--r--spawn/spawn_server.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/spawn/spawn_server.c b/spawn/spawn_server.c
index 53b143de..1d79ef15 100644
--- a/spawn/spawn_server.c
+++ b/spawn/spawn_server.c
@@ -317,10 +317,7 @@ void spawn_server(void)
// close all open file descriptors, except the standard ones
// the caller may have left open files (lxc-attach has this issue)
- int fd;
- for(fd = (int)(sysconf(_SC_OPEN_MAX) - 1) ; fd > 2 ; --fd)
- if(fd_is_valid(fd))
- close(fd);
+ for_each_open_fd(OPEN_FD_ACTION_CLOSE, OPEN_FD_EXCLUDE_STDIN | OPEN_FD_EXCLUDE_STDOUT | OPEN_FD_EXCLUDE_STDERR);
// Have the libuv IPC pipe be closed when forking child processes
(void) fcntl(0, F_SETFD, FD_CLOEXEC);