diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:19:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:20:17 +0000 |
commit | a64a253794ac64cb40befee54db53bde17dd0d49 (patch) | |
tree | c1024acc5f6e508814b944d99f112259bb28b1be /libnetdata/popen/popen.c | |
parent | New upstream version 1.10.0+dfsg (diff) | |
download | netdata-a64a253794ac64cb40befee54db53bde17dd0d49.tar.xz netdata-a64a253794ac64cb40befee54db53bde17dd0d49.zip |
New upstream version 1.11.0+dfsgupstream/1.11.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | libnetdata/popen/popen.c (renamed from src/popen.c) | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/popen.c b/libnetdata/popen/popen.c index eda1c05b9..845363fd2 100644 --- a/src/popen.c +++ b/libnetdata/popen/popen.c @@ -1,4 +1,6 @@ -#include "common.h" +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "../libnetdata.h" /* struct mypopen { @@ -67,7 +69,7 @@ FILE *mypopen(const char *command, volatile pid_t *pidptr) // close all files int i; - for(i = (int) (sysconf(_SC_OPEN_MAX) - 1); i > 0; i--) + for(i = (int) (sysconf(_SC_OPEN_MAX) - 1); i >= 0; i--) if(i != STDIN_FILENO && i != STDERR_FILENO && i != pipefd[PIPE_WRITE]) close(i); // move the pipe to stdout @@ -136,7 +138,7 @@ FILE *mypopene(const char *command, volatile pid_t *pidptr, char **env) { // close all files int i; - for(i = (int) (sysconf(_SC_OPEN_MAX) - 1); i > 0; i--) + for(i = (int) (sysconf(_SC_OPEN_MAX) - 1); i >= 0; i--) if(i != STDIN_FILENO && i != STDERR_FILENO && i != pipefd[PIPE_WRITE]) close(i); // move the pipe to stdout |