remove pid file when failing to load modules

This commit is contained in:
Moises Silva 2011-05-05 19:33:02 -04:00
parent 42d40227d9
commit a8d1b80b83
1 changed files with 4 additions and 1 deletions

View File

@ -921,7 +921,10 @@ int main(int argc, char *argv[])
switch_file_write(fd, pid_buffer, &pid_len);
if (switch_core_init_and_modload(flags, nc ? SWITCH_FALSE : SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) {
fprintf(stderr, "Cannot Initialize [%s]\n", err);
fprintf(stderr, "Cannot Initialize [%s], deleting pid file [%s]\n", err, pid_path);
if (unlink(pid_path) != 0) {
fprintf(stderr, "Failed to delete pid file [%s]\n", pid_path);
}
return 255;
}