stas Thu Feb 22 02:15:52 2001 EDT
Modified files:
/php4/ext/standard exec.c
Log:
Fix #8992, patch by [EMAIL PROTECTED]
Index: php4/ext/standard/exec.c
diff -u php4/ext/standard/exec.c:1.49 php4/ext/standard/exec.c:1.50
--- php4/ext/standard/exec.c:1.49 Sun Jan 14 08:41:06 2001
+++ php4/ext/standard/exec.c Thu Feb 22 02:15:52 2001
@@ -15,7 +15,7 @@
| Author: Rasmus Lerdorf |
+----------------------------------------------------------------------+
*/
-/* $Id: exec.c,v 1.49 2001/01/14 16:41:06 rasmus Exp $ */
+/* $Id: exec.c,v 1.50 2001/02/22 10:15:52 stas Exp $ */
#include <stdio.h>
#include "php.h"
@@ -31,6 +31,9 @@
#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)
@@ -48,6 +51,7 @@
int overflow_limit, lcmd, ldir;
int rsrc_id;
char *b, *c, *d=NULL;
+ void (*sig_handler)();
PLS_FETCH();
FLS_FETCH();
@@ -89,6 +93,8 @@
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
@@ -98,9 +104,11 @@
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
@@ -109,6 +117,7 @@
if (!fp) {
php_error(E_WARNING, "Unable to fork [%s]", cmd);
efree(buf);
+ signal (SIGCHLD, sig_handler);
return -1;
}
}
@@ -137,6 +146,7 @@
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;
@@ -203,6 +213,7 @@
}
#endif
+ signal (SIGCHLD, sig_handler);
if (d) {
efree(d);
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]