]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
remove pid file when failing to load modules
authorMoises Silva <moy@sangoma.com>
Thu, 5 May 2011 23:33:02 +0000 (19:33 -0400)
committerMoises Silva <moy@sangoma.com>
Thu, 5 May 2011 23:33:02 +0000 (19:33 -0400)
src/switch.c

index 7633fcae9f0f467109dc42bd4f5b5d90380faebf..f5ffe950e236e78da3b3961b726af21418e3ceb3 100644 (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;
        }