summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2009-09-30 13:04:28 +0000
committerDmitry Stogov <dmitry@php.net>2009-09-30 13:04:28 +0000
commit7a535b807c14649ceb5c01a04a21931fc8ca7303 (patch)
tree08e54ba6c9586278865f18cab4a48a71af678609
parenta4cbecd20c4851d74c6dab116cf05a4f2497c8a8 (diff)
downloadphp-git-7a535b807c14649ceb5c01a04a21931fc8ca7303.tar.gz
pcntl_exec() should inherit environment in case it's not provided as an argument
-rwxr-xr-xext/pcntl/pcntl.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c
index bee1693f1d..20f0cd39f2 100755
--- a/ext/pcntl/pcntl.c
+++ b/ext/pcntl/pcntl.c
@@ -727,16 +727,19 @@ PHP_FUNCTION(pcntl_exec)
if (return_val == HASH_KEY_IS_LONG) efree(key);
}
*(pair) = NULL;
- }
-
- if (execve(path, argv, envp) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error has occured: (errno %d) %s", errno, strerror(errno));
- }
+
+ if (execve(path, argv, envp) == -1) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error has occured: (errno %d) %s", errno, strerror(errno));
+ }
- /* Cleanup */
- if (envp != NULL) {
+ /* Cleanup */
for (pair = envp; *pair != NULL; pair++) efree(*pair);
efree(envp);
+ } else {
+
+ if (execv(path, argv) == -1) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error has occured: (errno %d) %s", errno, strerror(errno));
+ }
}
efree(argv);