summaryrefslogtreecommitdiff
path: root/ext/standard/exec.c
diff options
context:
space:
mode:
authorAndré Langhorst <andre@php.net>2001-02-23 05:08:15 +0000
committerAndré Langhorst <andre@php.net>2001-02-23 05:08:15 +0000
commit9fa484104e56299fd40788a9a3df1cca77e599fc (patch)
tree5743c5b38f5f4d8831a6b8b84c53ff93669e591c /ext/standard/exec.c
parentc8a22a384897dbc68dc602dd7cb8a45613902c05 (diff)
downloadphp-git-9fa484104e56299fd40788a9a3df1cca77e599fc.tar.gz
fix stas' last commit, added additional ifdefs PHP_SIGCHILD to fix win32 build
Diffstat (limited to 'ext/standard/exec.c')
-rw-r--r--ext/standard/exec.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/ext/standard/exec.c b/ext/standard/exec.c
index 438112b922..c4bd0abc21 100644
--- a/ext/standard/exec.c
+++ b/ext/standard/exec.c
@@ -51,7 +51,9 @@ int php_Exec(int type, char *cmd, pval *array, pval *return_value)
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 @@ int php_Exec(int type, char *cmd, pval *array, pval *return_value)
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 @@ int php_Exec(int type, char *cmd, pval *array, pval *return_value)
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 @@ int php_Exec(int type, char *cmd, pval *array, pval *return_value)
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 @@ int php_Exec(int type, char *cmd, pval *array, pval *return_value)
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 @@ int php_Exec(int type, char *cmd, pval *array, pval *return_value)
FG(pclose_ret) = WEXITSTATUS(FG(pclose_ret));
}
#endif
-
+#if PHP_SIGCHILD
signal (SIGCHLD, sig_handler);
+#endif
if (d) {
efree(d);
}