[Freeswitch-svn] [commit] r6559 - freeswitch/trunk/src

Freeswitch SVN mikej at freeswitch.org
Thu Dec 6 21:03:55 EST 2007


Author: mikej
Date: Thu Dec  6 21:03:55 2007
New Revision: 6559

Modified:
   freeswitch/trunk/src/switch.c

Log:
cleanup pid file on orderly exit.

Modified: freeswitch/trunk/src/switch.c
==============================================================================
--- freeswitch/trunk/src/switch.c	(original)
+++ freeswitch/trunk/src/switch.c	Thu Dec  6 21:03:55 2007
@@ -214,6 +214,7 @@
 	int known_opt;
  	int high_prio = 0;
 	switch_core_flag_t flags = SCF_USE_SQL;
+	int status;
 
 #ifdef WIN32
 	SERVICE_TABLE_ENTRY dispatchTable[] = {
@@ -428,11 +429,16 @@
 	}
 
 	fprintf(f, "%d", pid = getpid());
-	fclose(f);
+	fflush(f);
 
 	switch_core_runtime_loop(nc);
 
-	return switch_core_destroy();
+	status = switch_core_destroy();
+
+	fclose(f);
+	unlink(pid_path);
+
+	return status;
 }
 
 /* For Emacs:



More information about the Freeswitch-svn mailing list