diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-09-23 08:33:06 (GMT) |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-09-23 08:33:06 (GMT) |
commit | 4295decfbf06adfa1bf019d28e9044971607b2d6 (patch) | |
tree | 416ac41722c554dab36231440b0f2846375a8b82 /lib/utils_cmd.c | |
parent | bef0d0dd4ab04ac1189071526fae4031bec36b1d (diff) | |
download | monitoring-plugins-4295decfbf06adfa1bf019d28e9044971607b2d6.tar.gz |
open_max is a library function now, it should be mp_open_maxrefs/pull/1924/head
Diffstat (limited to 'lib/utils_cmd.c')
-rw-r--r-- | lib/utils_cmd.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/utils_cmd.c b/lib/utils_cmd.c index 71da9d2..ef7053a 100644 --- a/lib/utils_cmd.c +++ b/lib/utils_cmd.c | |||
@@ -89,7 +89,7 @@ extern void die (int, const char *, ...) | |||
89 | void | 89 | void |
90 | cmd_init (void) | 90 | cmd_init (void) |
91 | { | 91 | { |
92 | long maxfd = open_max(); | 92 | long maxfd = mp_open_max(); |
93 | 93 | ||
94 | /* if maxfd is unnaturally high, we force it to a lower value | 94 | /* if maxfd is unnaturally high, we force it to a lower value |
95 | * ( e.g. on SunOS, when ulimit is set to unlimited: 2147483647 this would cause | 95 | * ( e.g. on SunOS, when ulimit is set to unlimited: 2147483647 this would cause |
@@ -145,7 +145,7 @@ _cmd_open (char *const *argv, int *pfd, int *pfderr) | |||
145 | /* close all descriptors in _cmd_pids[] | 145 | /* close all descriptors in _cmd_pids[] |
146 | * This is executed in a separate address space (pure child), | 146 | * This is executed in a separate address space (pure child), |
147 | * so we don't have to worry about async safety */ | 147 | * so we don't have to worry about async safety */ |
148 | long maxfd = open_max(); | 148 | long maxfd = mp_open_max(); |
149 | for (i = 0; i < maxfd; i++) | 149 | for (i = 0; i < maxfd; i++) |
150 | if (_cmd_pids[i] > 0) | 150 | if (_cmd_pids[i] > 0) |
151 | close (i); | 151 | close (i); |
@@ -172,7 +172,7 @@ _cmd_close (int fd) | |||
172 | pid_t pid; | 172 | pid_t pid; |
173 | 173 | ||
174 | /* make sure the provided fd was opened */ | 174 | /* make sure the provided fd was opened */ |
175 | long maxfd = open_max(); | 175 | long maxfd = mp_open_max(); |
176 | if (fd < 0 || fd > maxfd || !_cmd_pids || (pid = _cmd_pids[fd]) == 0) | 176 | if (fd < 0 || fd > maxfd || !_cmd_pids || (pid = _cmd_pids[fd]) == 0) |
177 | return -1; | 177 | return -1; |
178 | 178 | ||
@@ -385,7 +385,7 @@ timeout_alarm_handler (int signo) | |||
385 | printf (_("%s - Plugin timed out after %d seconds\n"), | 385 | printf (_("%s - Plugin timed out after %d seconds\n"), |
386 | state_text(timeout_state), timeout_interval); | 386 | state_text(timeout_state), timeout_interval); |
387 | 387 | ||
388 | long maxfd = open_max(); | 388 | long maxfd = mp_open_max(); |
389 | if(_cmd_pids) for(i = 0; i < maxfd; i++) { | 389 | if(_cmd_pids) for(i = 0; i < maxfd; i++) { |
390 | if(_cmd_pids[i] != 0) kill(_cmd_pids[i], SIGKILL); | 390 | if(_cmd_pids[i] != 0) kill(_cmd_pids[i], SIGKILL); |
391 | } | 391 | } |