[pulseaudio-commits] r2464 - /trunk/src/pulsecore/core-util.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Sun May 18 12:09:16 PDT 2008


Author: lennart
Date: Sun May 18 21:09:14 2008
New Revision: 2464

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2464&root=pulseaudio&view=rev
Log:
fix pa_close_all() to make it actually work as advertised

Modified:
    trunk/src/pulsecore/core-util.c

Modified: trunk/src/pulsecore/core-util.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/core-util.c?rev=2464&root=pulseaudio&r1=2463&r2=2464&view=diff
==============================================================================
--- trunk/src/pulsecore/core-util.c (original)
+++ trunk/src/pulsecore/core-util.c Sun May 18 21:09:14 2008
@@ -1774,10 +1774,11 @@
 
     i = 0;
     if (except_fd >= 0) {
+        int fd;
         p[i++] = except_fd;
 
-        while ((p[i++] = va_arg(ap, int)) >= 0)
-            ;
+        while ((fd = va_arg(ap, int)) >= 0)
+            p[i++] = fd;
     }
     p[i] = -1;
 
@@ -1803,6 +1804,7 @@
         struct dirent *de;
 
         while ((de = readdir(d))) {
+            pa_bool_t found;
             long l;
             char *e = NULL;
             int i;
@@ -1826,17 +1828,23 @@
                 return -1;
             }
 
-            if (fd <= 3)
+            if (fd < 3)
                 continue;
 
             if (fd == dirfd(d))
                 continue;
 
+            found = FALSE;
             for (i = 0; except_fds[i] >= 0; i++)
-                if (except_fds[i] == fd)
-                    continue;
-
-            if (close(fd) < 0) {
+                if (except_fds[i] == fd) {
+                    found = TRUE;
+                    break;
+                }
+
+            if (found)
+                continue;
+
+            if (pa_close(fd) < 0) {
                 saved_errno = errno;
                 closedir(d);
                 errno = saved_errno;
@@ -1890,10 +1898,11 @@
 
     i = 0;
     if (except >= 1) {
+        int sig;
         p[i++] = except;
 
-        while ((p[i++] = va_arg(ap, int)) >= 0)
-            ;
+        while ((sig = va_arg(ap, int)) >= 0)
+            p[i++] = sig;
     }
     p[i] = -1;
 
@@ -1957,12 +1966,12 @@
     int sig;
 
     for (sig = 1; sig < _NSIG; sig++) {
-        int reset = 1;
+        pa_bool_t reset = TRUE;
 
         switch (sig) {
             case SIGKILL:
             case SIGSTOP:
-                reset = 0;
+                reset = FALSE;
                 break;
 
             default: {
@@ -1970,7 +1979,7 @@
 
                 for (i = 0; except[i] > 0; i++) {
                     if (sig == except[i]) {
-                        reset = 0;
+                        reset = FALSE;
                         break;
                     }
                 }




More information about the pulseaudio-commits mailing list