Ver código fonte

logsys_format_set should use its own internal copy of format_buffer

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1796 fd59a12c-fef9-0310-b244-a6a79926bd2f
Fabio M. Di Nitto 17 anos atrás
pai
commit
f7c4cea567
1 arquivos alterados com 10 adições e 4 exclusões
  1. 10 4
      exec/logsys.c

+ 10 - 4
exec/logsys.c

@@ -873,10 +873,16 @@ void logsys_format_set (char *format)
 {
 	pthread_mutex_lock (&logsys_config_mutex);
 
-	if (format)
-		format_buffer = format;
-	else
-		format_buffer = "[%6s] %b";
+	if (format_buffer) {
+		free(format_buffer);
+		format_buffer = NULL;
+	}
+
+	if (format) {
+		format_buffer = strdup(format);
+	} else {
+		format_buffer = strdup("[%6s] %b");
+	}
 
 	pthread_mutex_unlock (&logsys_config_mutex);
 }