diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2023-09-23 08:47:01 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-23 08:47:01 (GMT) |
commit | 719e27ddc2f0b48bcd7fe5584b23e3ce83ddf291 (patch) | |
tree | 1ca6c622275cf8d57e0b6b6d7fb0da4cce8e9205 /plugins/popen.c | |
parent | fe718dec117a7adb8a7107a4137a86c79b54d15f (diff) | |
parent | 4295decfbf06adfa1bf019d28e9044971607b2d6 (diff) | |
download | monitoring-plugins-719e27ddc2f0b48bcd7fe5584b23e3ce83ddf291.tar.gz |
Merge pull request #1924 from RincewindsHat/compiler_warnings_4_1
Centralise and refactor maxfd related functionality
Diffstat (limited to 'plugins/popen.c')
-rw-r--r-- | plugins/popen.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/plugins/popen.c b/plugins/popen.c index 723817d..b395f14 100644 --- a/plugins/popen.c +++ b/plugins/popen.c | |||
@@ -38,8 +38,9 @@ | |||
38 | * | 38 | * |
39 | *****************************************************************************/ | 39 | *****************************************************************************/ |
40 | 40 | ||
41 | #include "common.h" | 41 | #include "./common.h" |
42 | #include "utils.h" | 42 | #include "./utils.h" |
43 | #include "../lib/maxfd.h" | ||
43 | 44 | ||
44 | /* extern so plugin has pid to kill exec'd process on timeouts */ | 45 | /* extern so plugin has pid to kill exec'd process on timeouts */ |
45 | extern pid_t *childpid; | 46 | extern pid_t *childpid; |
@@ -177,8 +178,7 @@ spopen (const char *cmdstring) | |||
177 | } | 178 | } |
178 | argv[i] = NULL; | 179 | argv[i] = NULL; |
179 | 180 | ||
180 | if(maxfd == 0) | 181 | long maxfd = mp_open_max(); |
181 | maxfd = open_max(); | ||
182 | 182 | ||
183 | if (childpid == NULL) { /* first time through */ | 183 | if (childpid == NULL) { /* first time through */ |
184 | if ((childpid = calloc ((size_t)maxfd, sizeof (pid_t))) == NULL) | 184 | if ((childpid = calloc ((size_t)maxfd, sizeof (pid_t))) == NULL) |