cvs: php4 /ext/pcntl pcntl.c
| From: | Jason Greene | Date: | Mon, 06 May 2002 19:48:40 +0000 |
| Subject: | cvs: php4 /ext/pcntl pcntl.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-11729@lists.php.net to get a copy of this message | ||
jason Mon May 6 15:48:40 2002 EDT
Modified files:
/php4/ext/pcntl pcntl.c
Log:
Fix type-o that broke ZTS build
Fix 3 nasty crash bugs that could occur if pcntl_exec's call to execve errored
Index: php4/ext/pcntl/pcntl.c
diff -u php4/ext/pcntl/pcntl.c:1.24 php4/ext/pcntl/pcntl.c:1.25
--- php4/ext/pcntl/pcntl.c:1.24 Tue Apr 23 17:21:41 2002
+++ php4/ext/pcntl/pcntl.c Mon May 6 15:48:39 2002
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pcntl.c,v 1.24 2002/04/23 21:21:41 mfischer Exp $ */
+/* $Id: pcntl.c,v 1.25 2002/05/06 19:48:39 jason Exp $ */
#define PCNTL_DEBUG 0
@@ -396,6 +396,8 @@
for ( zend_hash_internal_pointer_reset(args_hash), current_arg = argv+1;
(argi < argc && (zend_hash_get_current_data(args_hash, (void **) &element) ==
SUCCESS));
(argi++, current_arg++, zend_hash_move_forward(args_hash)) ) {
+
+ convert_to_string_ex(element);
*current_arg = Z_STRVAL_PP(element);
}
*(current_arg) = NULL;
@@ -424,6 +426,9 @@
pair--;
continue;
}
+
+ convert_to_string_ex(element);
+
/* Length of element + equal sign + length of key + null */
pair_length = Z_STRLEN_PP(element) + key_length + 2;
*pair = emalloc(pair_length);
@@ -439,14 +444,16 @@
if (execve(path, argv, envp) == -1) {
php_error(E_WARNING, "Error has occured in %s: (errno %d) %s",
- get_active_function_name(TSRMLS_CC), errno, strerror(errno));
+ get_active_function_name(TSRMLS_C), errno, strerror(errno));
}
/* Cleanup */
- for (pair = envp; *pair != NULL; pair++) efree(*pair);
-
+ if (envp != NULL) {
+ for (pair = envp; *pair != NULL; pair++) efree(*pair);
+ free_alloca(envp);
+ }
+
free_alloca(argv);
- free_alloca(envp);
RETURN_FALSE;
}