]> code.delx.au - pulseaudio/commitdiff
log: Fix thread name printing
authorTanu Kaskinen <tanu.kaskinen@linux.intel.com>
Thu, 11 Jul 2013 11:14:29 +0000 (14:14 +0300)
committerTanu Kaskinen <tanu.kaskinen@linux.intel.com>
Thu, 11 Jul 2013 11:15:33 +0000 (14:15 +0300)
Not all threads have a name.

Thanks to Pierre Ossman for the patch.

src/pulsecore/log.c

index 61873fa48cae42c49a582b0ec3ba1ec8fddf0fa6..e4f1c300fcb220269fb0137ae7bf2b2fb4f7d430 100644 (file)
@@ -363,9 +363,11 @@ void pa_log_levelv_meta(
     pa_vsnprintf(text, sizeof(text), format, ap);
 
     if ((_flags & PA_LOG_PRINT_META) && file && line > 0 && func)
-        pa_snprintf(location, sizeof(location), "[%s][%s:%i %s()] ", pa_thread_get_name(pa_thread_self()), file, line, func);
+        pa_snprintf(location, sizeof(location), "[%s][%s:%i %s()] ",
+                    pa_strnull(pa_thread_get_name(pa_thread_self())), file, line, func);
     else if ((_flags & (PA_LOG_PRINT_META|PA_LOG_PRINT_FILE)) && file)
-        pa_snprintf(location, sizeof(location), "[%s] %s: ", pa_thread_get_name(pa_thread_self()), pa_path_get_filename(file));
+        pa_snprintf(location, sizeof(location), "[%s] %s: ",
+                    pa_strnull(pa_thread_get_name(pa_thread_self())), pa_path_get_filename(file));
     else
         location[0] = 0;