diff options
Diffstat (limited to 'plugins/popen.c')
| -rw-r--r-- | plugins/popen.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/plugins/popen.c b/plugins/popen.c index 723817d5..036bc608 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; |
| @@ -49,9 +50,9 @@ extern FILE *child_process; | |||
| 49 | FILE *spopen (const char *); | 50 | FILE *spopen (const char *); |
| 50 | int spclose (FILE *); | 51 | int spclose (FILE *); |
| 51 | #ifdef REDHAT_SPOPEN_ERROR | 52 | #ifdef REDHAT_SPOPEN_ERROR |
| 52 | RETSIGTYPE popen_sigchld_handler (int); | 53 | void popen_sigchld_handler (int); |
| 53 | #endif | 54 | #endif |
| 54 | RETSIGTYPE popen_timeout_alarm_handler (int); | 55 | void popen_timeout_alarm_handler (int); |
| 55 | 56 | ||
| 56 | #include <stdarg.h> /* ANSI C header file */ | 57 | #include <stdarg.h> /* ANSI C header file */ |
| 57 | #include <fcntl.h> | 58 | #include <fcntl.h> |
| @@ -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) |
| @@ -266,7 +266,7 @@ spclose (FILE * fp) | |||
| 266 | } | 266 | } |
| 267 | 267 | ||
| 268 | #ifdef REDHAT_SPOPEN_ERROR | 268 | #ifdef REDHAT_SPOPEN_ERROR |
| 269 | RETSIGTYPE | 269 | void |
| 270 | popen_sigchld_handler (int signo) | 270 | popen_sigchld_handler (int signo) |
| 271 | { | 271 | { |
| 272 | if (signo == SIGCHLD) | 272 | if (signo == SIGCHLD) |
| @@ -274,7 +274,7 @@ popen_sigchld_handler (int signo) | |||
| 274 | } | 274 | } |
| 275 | #endif | 275 | #endif |
| 276 | 276 | ||
| 277 | RETSIGTYPE | 277 | void |
| 278 | popen_timeout_alarm_handler (int signo) | 278 | popen_timeout_alarm_handler (int signo) |
| 279 | { | 279 | { |
| 280 | int fh; | 280 | int fh; |
