svn: /php/php-src/ branches/PHP_5_3/ext/pcntl/pcntl.c trunk/ext/pcntl/pcntl.c
| From: | Dmitry Stogov | Date: | Wed, 30 Sep 2009 13:04:28 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_3/ext/pcntl/pcntl.c trunk/ext/pcntl/pcntl.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-60555@lists.php.net to get a copy of this message | ||
dmitry Wed, 30 Sep 2009 13:04:28 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=288993
Log:
pcntl_exec() should inherit environment in case it's not provided as an argument
Changed paths:
U php/php-src/branches/PHP_5_3/ext/pcntl/pcntl.c
U php/php-src/trunk/ext/pcntl/pcntl.c
Modified: php/php-src/branches/PHP_5_3/ext/pcntl/pcntl.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pcntl/pcntl.c 2009-09-30 12:40:17 UTC (rev 288992)
+++ php/php-src/branches/PHP_5_3/ext/pcntl/pcntl.c 2009-09-30 13:04:28 UTC (rev 288993)
@@ -727,16 +727,19 @@
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);
Modified: php/php-src/trunk/ext/pcntl/pcntl.c
===================================================================
--- php/php-src/trunk/ext/pcntl/pcntl.c 2009-09-30 12:40:17 UTC (rev 288992)
+++ php/php-src/trunk/ext/pcntl/pcntl.c 2009-09-30 13:04:28 UTC (rev 288993)
@@ -727,18 +727,21 @@
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));
- }
-
- /* Cleanup */
- if (envp != NULL) {
+
+ if (execve(path, argv, envp) == -1) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error has occured: (errno %d) %s", errno,
strerror(errno));
+ }
+
+ /* 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);
RETURN_FALSE;