[pulseaudio-commits] r2323 - /branches/glitch-free/src/pulsecore/log.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Thu May 1 12:16:57 PDT 2008


Author: lennart
Date: Thu May  1 21:16:55 2008
New Revision: 2323

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2323&root=pulseaudio&view=rev
Log:
save and restore errno in log functions

Modified:
    branches/glitch-free/src/pulsecore/log.c

Modified: branches/glitch-free/src/pulsecore/log.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/glitch-free/src/pulsecore/log.c?rev=2323&root=pulseaudio&r1=2322&r2=2323&view=diff
==============================================================================
--- branches/glitch-free/src/pulsecore/log.c (original)
+++ branches/glitch-free/src/pulsecore/log.c Thu May  1 21:16:55 2008
@@ -30,6 +30,7 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <string.h>
+#include <errno.h>
 
 #ifdef HAVE_SYSLOG_H
 #include <syslog.h>
@@ -109,6 +110,7 @@
 
     const char *e;
     char *text, *t, *n, *location;
+    int saved_errno = errno;
 
     pa_assert(level < PA_LOG_LEVEL_MAX);
     pa_assert(format);
@@ -116,8 +118,10 @@
     if ((e = getenv(ENV_LOGLEVEL)))
         maximal_level = atoi(e);
 
-    if (level > maximal_level)
+    if (level > maximal_level) {
+        errno = saved_errno;
         return;
+    }
 
     text = pa_vsprintf_malloc(format, ap);
 
@@ -206,6 +210,8 @@
 
     pa_xfree(text);
     pa_xfree(location);
+
+    errno = saved_errno;
 }
 
 void pa_log_level_meta(




More information about the pulseaudio-commits mailing list