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

Freeswitch SVN mikej at freeswitch.org
Mon Dec 24 22:00:29 EST 2007


Author: mikej
Date: Mon Dec 24 22:00:29 2007
New Revision: 6977

Modified:
   freeswitch/trunk/src/switch.c

Log:
fix for FSCORE-78.  Write whole buffer of the pid into file with padded NULL's so that we don't leave leftovers behind from a crash.

Modified: freeswitch/trunk/src/switch.c
==============================================================================
--- freeswitch/trunk/src/switch.c	(original)
+++ freeswitch/trunk/src/switch.c	Mon Dec 24 22:00:29 2007
@@ -443,9 +443,10 @@
 
 	pid = getpid();
 
+	memset(pid_buffer, 0, sizeof(pid_buffer));
 	switch_snprintf(pid_path, sizeof(pid_path), "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, pfile);
 	switch_snprintf(pid_buffer, sizeof(pid_buffer), "%d", pid);
-	pid_len = strlen(pid_buffer);
+	pid_len = sizeof(pid_buffer);
 
 	apr_pool_create(&pool, NULL);
     if (switch_file_open(&fd,



More information about the Freeswitch-svn mailing list