summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Greene <jason@php.net>2001-10-03 03:48:27 +0000
committerJason Greene <jason@php.net>2001-10-03 03:48:27 +0000
commitdc7d5df04888d88049b5387dc1b6321902ea6607 (patch)
treec7b541ea91d2038121d27aafa31739da3fe8875b
parent4039c24ad5f99383df8e6fafe2574533e04297e8 (diff)
downloadphp-git-dc7d5df04888d88049b5387dc1b6321902ea6607.tar.gz
Add cleanup on an exec failure
Remove debug comments
-rwxr-xr-xext/pcntl/pcntl.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c
index 8f7998c478..8663a539af 100755
--- a/ext/pcntl/pcntl.c
+++ b/ext/pcntl/pcntl.c
@@ -400,7 +400,6 @@ PHP_FUNCTION(pcntl_exec)
*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 @@ PHP_FUNCTION(pcntl_exec)
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;
}
/* }}} */