diff --git a/src/switch.c b/src/switch.c index df3574d2d7..241c674817 100644 --- a/src/switch.c +++ b/src/switch.c @@ -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]);