changeset 551:89fafb218396

Fix situations where the log path is unset.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 12 Nov 2012 18:32:08 +0200
parents 504a8b9297a3
children dfe46cd1b81b
files main.c
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/main.c	Mon Nov 12 14:30:59 2012 +0200
+++ b/main.c	Mon Nov 12 18:32:08 2012 +0200
@@ -1511,9 +1511,6 @@
     if (!optLogEnable)
         return FALSE;
 
-    th_free(win->logFilename);
-    win->logFilename = NULL;
-
     if (optLogPath != NULL)
     {
         char *lt = strrchr(optLogPath, SET_DIR_SEPARATOR);
@@ -1526,7 +1523,7 @@
     if (win->id == NULL)
     {
         win->logFilename = th_strdup_printf("%sroom_%d%s",
-            path, optPort, optLogExtension);
+            path != NULL ? path : "", optPort, optLogExtension);
     }
     else
     {
@@ -1542,7 +1539,9 @@
                 cleaned[pos] = '_';
         }
 
-        win->logFilename = th_strdup_printf("%s%s%s", path, cleaned, optLogExtension);
+        win->logFilename = th_strdup_printf("%s%s%s",
+            path != NULL ? path : "", cleaned, optLogExtension);
+
         th_free(cleaned);
     }