#if HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
+#if HAVE_SIGNAL_H
+#include <signal.h>
+#endif
/*
* If type==0, only last line of output is returned (exec)
int overflow_limit, lcmd, ldir;
int rsrc_id;
char *b, *c, *d=NULL;
+ void (*sig_handler)();
PLS_FETCH();
FLS_FETCH();
tmp = php_escape_shell_cmd(d);
efree(d);
d = tmp;
+
+ sig_handler = signal (SIGCHLD, SIG_DFL);
#ifdef PHP_WIN32
fp = V_POPEN(d, "rb");
#else
php_error(E_WARNING, "Unable to fork [%s]", d);
efree(d);
efree(buf);
+ signal (SIGCHLD, sig_handler);
return -1;
}
} else { /* not safe_mode */
+ sig_handler = signal (SIGCHLD, SIG_DFL);
#ifdef PHP_WIN32
fp = V_POPEN(cmd, "rb");
#else
if (!fp) {
php_error(E_WARNING, "Unable to fork [%s]", cmd);
efree(buf);
+ signal (SIGCHLD, sig_handler);
return -1;
}
}
if ( buf == NULL ) {
php_error(E_WARNING, "Unable to erealloc %d bytes for exec buffer",
buflen + EXEC_INPUT_BUF);
+ signal (SIGCHLD, sig_handler);
return -1;
}
buflen += EXEC_INPUT_BUF;
}
#endif
+ signal (SIGCHLD, sig_handler);
if (d) {
efree(d);
}