Handle null argv in switch.c

This commit is contained in:
Travis Cross 2014-08-22 01:09:05 +00:00
parent e2d67d4ead
commit 4f81e5942a

View File

@ -1053,7 +1053,7 @@ int main(int argc, char *argv[])
setrlimit(RLIMIT_STACK, &rlp);
apr_terminate();
ret = (int) execv(argv[0], argv);
if (argv) ret = (int) execv(argv[0], argv);
for (i = 0; i < argc; i++) {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s ", argv[i]);
@ -1215,7 +1215,7 @@ int main(int argc, char *argv[])
int j = 0;
switch_sleep(1000000);
if (execv(argv[0], argv) == -1) {
if (!argv || execv(argv[0], argv) == -1) {
fprintf(stderr, "Restart Failed [%s] resorting to plan b\n", strerror(errno));
for (j = 0; j < argc; j++) {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s ", argv[j]);