Avoid dead assignment of return value of execv

execv(3) only returns on error, and will always return -1 in that
case.
This commit is contained in:
Travis Cross 2014-04-30 21:57:07 +00:00
parent 5f3e98beb4
commit b9b5b0d827

View File

@ -1203,14 +1203,13 @@ int main(int argc, char *argv[])
int j = 0;
switch_sleep(1000000);
ret = (int) execv(argv[0], argv);
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]);
if (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]);
}
ret = system(buf);
}
ret = system(buf);
}
return ret;