summaryrefslogtreecommitdiffstats
path: root/plugins/popen.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/popen.c')
-rw-r--r--plugins/popen.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/plugins/popen.c b/plugins/popen.c
index 723817d..036bc60 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 */
45extern pid_t *childpid; 46extern pid_t *childpid;
@@ -49,9 +50,9 @@ extern FILE *child_process;
49FILE *spopen (const char *); 50FILE *spopen (const char *);
50int spclose (FILE *); 51int spclose (FILE *);
51#ifdef REDHAT_SPOPEN_ERROR 52#ifdef REDHAT_SPOPEN_ERROR
52RETSIGTYPE popen_sigchld_handler (int); 53void popen_sigchld_handler (int);
53#endif 54#endif
54RETSIGTYPE popen_timeout_alarm_handler (int); 55void 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
269RETSIGTYPE 269void
270popen_sigchld_handler (int signo) 270popen_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
277RETSIGTYPE 277void
278popen_timeout_alarm_handler (int signo) 278popen_timeout_alarm_handler (int signo)
279{ 279{
280 int fh; 280 int fh;