cvs: php4 /ext/pcntl pcntl.c
| From: | Jason Greene | Date: | Wed, 03 Oct 2001 03:48:27 +0000 |
| Subject: | cvs: php4 /ext/pcntl pcntl.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-7634@lists.php.net to get a copy of this message | ||
jason Tue Oct 2 23:48:27 2001 EDT
Modified files:
/php4/ext/pcntl pcntl.c
Log:
Add cleanup on an exec failure
Remove debug comments
Index: php4/ext/pcntl/pcntl.c
diff -u php4/ext/pcntl/pcntl.c:1.12 php4/ext/pcntl/pcntl.c:1.13
--- php4/ext/pcntl/pcntl.c:1.12 Sun Sep 30 02:59:12 2001
+++ php4/ext/pcntl/pcntl.c Tue Oct 2 23:48:27 2001
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pcntl.c,v 1.12 2001/09/30 06:59:12 jason Exp $ */
+/* $Id: pcntl.c,v 1.13 2001/10/03 03:48:27 jason Exp $ */
#define PCNTL_DEBUG 0
@@ -400,7 +400,6 @@
*current_arg=Z_STRVAL_PP(element);
}
*(current_arg)=NULL;
- /* while(*argv != NULL) printf("Arg: %s\n",*argv++); */
} else {
argv=alloca(2 * sizeof(char *));
*argv=path;
@@ -434,18 +433,23 @@
strlcat(*pair, Z_STRVAL_PP(element), pair_length);
/* Cleanup */
- if (return_val == HASH_KEY_IS_LONG) free_alloca(101);
+ if (return_val == HASH_KEY_IS_LONG) free_alloca(key);
}
*(pair)=NULL;
- /* while(*envp != NULL) printf("Env: %s\n",*envp++); */
}
if (execve(path, argv, envp) == -1) {
- php_error(E_ERROR, "Error has occured in %s: (errno %d) %s",
get_active_function_name(TSRMLS_CC),
+ php_error(E_WARNING, "Error has occured in %s: (errno %d) %s",
get_active_function_name(TSRMLS_CC),
errno, strerror(errno));
}
+ /* Cleanup */
+ for (pair=envp; *pair!=NULL; pair++) efree(*pair);
+
+ free_alloca(argv);
+ free_alloca(envp);
+
RETURN_FALSE;
}
/* }}} */