From df26e273774ca3db84bd4ed0bbf331149aa8498c Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Tue, 25 Dec 2007 03:00:29 +0000 Subject: [PATCH] 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. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6977 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/switch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/switch.c b/src/switch.c index a8f07af0c1..087f7c8626 100644 --- a/src/switch.c +++ b/src/switch.c @@ -443,9 +443,10 @@ int main(int argc, char *argv[]) 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,