cvs: php4 /ext/standard exec.c
| From: | Andr� Langhorst | Date: | Fri, 23 Feb 2001 05:08:15 +0000 |
| Subject: | cvs: php4 /ext/standard exec.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-4228@lists.php.net to get a copy of this message | ||
andre Thu Feb 22 21:08:15 2001 EDT
Modified files:
/php4/ext/standard exec.c
Log:
fix stas' last commit, added additional ifdefs PHP_SIGCHILD to fix win32 build
Index: php4/ext/standard/exec.c
diff -u php4/ext/standard/exec.c:1.50 php4/ext/standard/exec.c:1.51
--- php4/ext/standard/exec.c:1.50 Thu Feb 22 02:15:52 2001
+++ php4/ext/standard/exec.c Thu Feb 22 21:08:15 2001
@@ -15,7 +15,7 @@
| Author: Rasmus Lerdorf |
+----------------------------------------------------------------------+
*/
-/* $Id: exec.c,v 1.50 2001/02/22 10:15:52 stas Exp $ */
+/* $Id: exec.c,v 1.51 2001/02/23 05:08:15 andre Exp $ */
#include <stdio.h>
#include "php.h"
@@ -51,7 +51,9 @@
int overflow_limit, lcmd, ldir;
int rsrc_id;
char *b, *c, *d=NULL;
+#if PHP_SIGCHILD
void (*sig_handler)();
+#endif
PLS_FETCH();
FLS_FETCH();
@@ -93,8 +95,9 @@
tmp = php_escape_shell_cmd(d);
efree(d);
d = tmp;
-
+#if PHP_SIGCHILD
sig_handler = signal (SIGCHLD, SIG_DFL);
+#endif
#ifdef PHP_WIN32
fp = V_POPEN(d, "rb");
#else
@@ -104,11 +107,15 @@
php_error(E_WARNING, "Unable to fork [%s]", d);
efree(d);
efree(buf);
+#if PHP_SIGCHILD
signal (SIGCHLD, sig_handler);
+#endif
return -1;
}
} else { /* not safe_mode */
+#if PHP_SIGCHILD
sig_handler = signal (SIGCHLD, SIG_DFL);
+#endif
#ifdef PHP_WIN32
fp = V_POPEN(cmd, "rb");
#else
@@ -117,7 +124,9 @@
if (!fp) {
php_error(E_WARNING, "Unable to fork [%s]", cmd);
efree(buf);
+#if PHP_SIGCHILD
signal (SIGCHLD, sig_handler);
+#endif
return -1;
}
}
@@ -146,7 +155,9 @@
if ( buf == NULL ) {
php_error(E_WARNING, "Unable to erealloc %d bytes for exec buffer",
buflen + EXEC_INPUT_BUF);
+#if PHP_SIGCHILD
signal (SIGCHLD, sig_handler);
+#endif
return -1;
}
buflen += EXEC_INPUT_BUF;
@@ -212,8 +223,9 @@
FG(pclose_ret) = WEXITSTATUS(FG(pclose_ret));
}
#endif
-
+#if PHP_SIGCHILD
signal (SIGCHLD, sig_handler);
+#endif
if (d) {
efree(d);
}