From: Moises Silva Date: Thu, 5 May 2011 23:33:02 +0000 (-0400) Subject: remove pid file when failing to load modules X-Git-Tag: v1.2.3^2~71^2^2~245^2~2^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8d1b80b83bb7a8ae66d883d5733351513065acd;p=thirdparty%2Ffreeswitch.git remove pid file when failing to load modules --- diff --git a/src/switch.c b/src/switch.c index 7633fcae9f..f5ffe950e2 100644 --- a/src/switch.c +++ b/src/switch.c @@ -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; }