[pulseaudio-commits] r1811 - in /branches/lennart/src: daemon/ modules/ pulse/ pulsecore/

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Tue Sep 11 17:04:22 PDT 2007


Author: lennart
Date: Wed Sep 12 02:04:21 2007
New Revision: 1811

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1811&root=pulseaudio&view=rev
Log:
consolidate close() calls to pa_close(), and make sure on every occasion that we handle failures of close() sensibly

Modified:
    branches/lennart/src/daemon/cpulimit.c
    branches/lennart/src/daemon/main.c
    branches/lennart/src/modules/module-esound-compat-spawnfd.c
    branches/lennart/src/modules/module-mmkbd-evdev.c
    branches/lennart/src/modules/module-oss.c
    branches/lennart/src/modules/module-pipe-sink.c
    branches/lennart/src/modules/module-pipe-source.c
    branches/lennart/src/modules/oss-util.c
    branches/lennart/src/pulse/context.c
    branches/lennart/src/pulse/mainloop.c
    branches/lennart/src/pulsecore/authkey.c
    branches/lennart/src/pulsecore/core-util.c
    branches/lennart/src/pulsecore/fdsem.c
    branches/lennart/src/pulsecore/pid.c
    branches/lennart/src/pulsecore/random.c
    branches/lennart/src/pulsecore/shm.c
    branches/lennart/src/pulsecore/sound-file-stream.c
    branches/lennart/src/pulsecore/sound-file.c

Modified: branches/lennart/src/daemon/cpulimit.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/daemon/cpulimit.c?rev=1811&root=pulseaudio&r1=1810&r2=1811&view=diff
==============================================================================
--- branches/lennart/src/daemon/cpulimit.c (original)
+++ branches/lennart/src/daemon/cpulimit.c Wed Sep 12 02:04:21 2007
@@ -223,9 +223,9 @@
     }
 
     if (the_pipe[0] >= 0)
-        close(the_pipe[0]);
+        pa_assert_se(pa_close(the_pipe[0]) == 0);
     if (the_pipe[1] >= 0)
-        close(the_pipe[1]);
+        pa_assert_se(pa_close(the_pipe[1]) == 0);
     the_pipe[0] = the_pipe[1] = -1;
 
     if (installed) {

Modified: branches/lennart/src/daemon/main.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/daemon/main.c?rev=1811&root=pulseaudio&r1=1810&r2=1811&view=diff
==============================================================================
--- branches/lennart/src/daemon/main.c (original)
+++ branches/lennart/src/daemon/main.c Wed Sep 12 02:04:21 2007
@@ -160,9 +160,9 @@
 
 static void close_pipe(int p[2]) {
     if (p[0] != -1)
-        close(p[0]);
+        pa_assert_se(pa_close(p[0]) == 0);
     if (p[1] != -1)
-        close(p[1]);
+        pa_assert_se(pa_close(p[1]) == 0);
     p[0] = p[1] = -1;
 }
 
@@ -537,7 +537,7 @@
         if (child != 0) {
             /* Father */
 
-            close(daemon_pipe[1]);
+            pa_assert_se(pa_close(daemon_pipe[1]) == 0);
             daemon_pipe[1] = -1;
 
             if (pa_loop_read(daemon_pipe[0], &retval, sizeof(retval), NULL) != sizeof(retval)) {
@@ -553,7 +553,7 @@
             goto finish;
         }
 
-        close(daemon_pipe[0]);
+        pa_assert_se(pa_close(daemon_pipe[0]) == 0);
         daemon_pipe[0] = -1;
 #endif
 
@@ -568,9 +568,9 @@
 #endif
 
 #ifndef OS_IS_WIN32
-        close(0);
-        close(1);
-        close(2);
+        pa_close(0);
+        pa_close(1);
+        pa_close(2);
 
         open("/dev/null", O_RDONLY);
         open("/dev/null", O_WRONLY);
@@ -592,7 +592,7 @@
 #ifdef TIOCNOTTY
         if ((tty_fd = open("/dev/tty", O_RDWR)) >= 0) {
             ioctl(tty_fd, TIOCNOTTY, (char*) 0);
-            close(tty_fd);
+            pa_assert_se(pa_close(tty_fd) == 0);
         }
 #endif
     }

Modified: branches/lennart/src/modules/module-esound-compat-spawnfd.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/module-esound-compat-spawnfd.c?rev=1811&root=pulseaudio&r1=1810&r2=1811&view=diff
==============================================================================
--- branches/lennart/src/modules/module-esound-compat-spawnfd.c (original)
+++ branches/lennart/src/modules/module-esound-compat-spawnfd.c Wed Sep 12 02:04:21 2007
@@ -65,7 +65,7 @@
     if (pa_loop_write(fd, &x, sizeof(x), NULL) != sizeof(x))
         pa_log_warn("WARNING: write(%u, 1, 1) failed: %s", fd, pa_cstrerror(errno));
 
-    close(fd);
+    pa_assert_se(pa_close(fd) == 0);
 
     pa_module_unload_request(m);
 

Modified: branches/lennart/src/modules/module-mmkbd-evdev.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/module-mmkbd-evdev.c?rev=1811&root=pulseaudio&r1=1810&r2=1811&view=diff
==============================================================================
--- branches/lennart/src/modules/module-mmkbd-evdev.c (original)
+++ branches/lennart/src/modules/module-mmkbd-evdev.c Wed Sep 12 02:04:21 2007
@@ -254,7 +254,7 @@
         m->core->mainloop->io_free(u->io);
 
     if (u->fd >= 0)
-        close(u->fd);
+        pa_assert_se(pa_close(u->fd) == 0);
 
     pa_xfree(u->sink_name);
     pa_xfree(u);

Modified: branches/lennart/src/modules/module-oss.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/module-oss.c?rev=1811&root=pulseaudio&r1=1810&r2=1811&view=diff
==============================================================================
--- branches/lennart/src/modules/module-oss.c (original)
+++ branches/lennart/src/modules/module-oss.c Wed Sep 12 02:04:21 2007
@@ -476,7 +476,7 @@
 
     /* Let's suspend */
     ioctl(u->fd, SNDCTL_DSP_SYNC, NULL);
-    close(u->fd);
+    pa_close(u->fd);
     u->fd = -1;
 
     if (u->rtpoll_item) {
@@ -588,7 +588,7 @@
     return 0;
 
 fail:
-    close(u->fd);
+    pa_close(u->fd);
     u->fd = -1;
     return -1;
 }
@@ -1324,7 +1324,7 @@
     if (u)
         pa__done(m);
     else if (fd >= 0)
-        close(fd);
+        pa_close(fd);
 
     if (ma)
         pa_modargs_free(ma);
@@ -1391,7 +1391,7 @@
         munmap(u->out_mmap, u->out_hwbuf_size);
     
     if (u->fd >= 0)
-        close(u->fd);
+        pa_close(u->fd);
 
     pa_xfree(u->device_name);
     

Modified: branches/lennart/src/modules/module-pipe-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/module-pipe-sink.c?rev=1811&root=pulseaudio&r1=1810&r2=1811&view=diff
==============================================================================
--- branches/lennart/src/modules/module-pipe-sink.c (original)
+++ branches/lennart/src/modules/module-pipe-sink.c Wed Sep 12 02:04:21 2007
@@ -335,7 +335,7 @@
     }
 
     if (u->fd >= 0)
-        close(u->fd);
+        pa_assert_se(pa_close(u->fd) == 0);
 
     pa_xfree(u);
 }

Modified: branches/lennart/src/modules/module-pipe-source.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/module-pipe-source.c?rev=1811&root=pulseaudio&r1=1810&r2=1811&view=diff
==============================================================================
--- branches/lennart/src/modules/module-pipe-source.c (original)
+++ branches/lennart/src/modules/module-pipe-source.c Wed Sep 12 02:04:21 2007
@@ -313,7 +313,7 @@
     }
 
     if (u->fd >= 0)
-        close(u->fd);
+        pa_assert_se(pa_close(u->fd) == 0);
 
     pa_xfree(u);
 }

Modified: branches/lennart/src/modules/oss-util.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/oss-util.c?rev=1811&root=pulseaudio&r1=1810&r2=1811&view=diff
==============================================================================
--- branches/lennart/src/modules/oss-util.c (original)
+++ branches/lennart/src/modules/oss-util.c Wed Sep 12 02:04:21 2007
@@ -68,7 +68,7 @@
 
             pa_log_warn("'%s' doesn't support full duplex", device);
 
-            close(fd);
+            pa_close(fd);
         }
 
         if ((fd = open(device, (*mode = O_WRONLY)|O_NDELAY|O_NOCTTY)) < 0) {
@@ -147,7 +147,7 @@
 
 fail:
     if (fd >= 0)
-        close(fd);
+        pa_close(fd);
     return -1;
 }
 

Modified: branches/lennart/src/pulse/context.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulse/context.c?rev=1811&root=pulseaudio&r1=1810&r2=1811&view=diff
==============================================================================
--- branches/lennart/src/pulse/context.c (original)
+++ branches/lennart/src/pulse/context.c Wed Sep 12 02:04:21 2007
@@ -524,7 +524,7 @@
         int n;
 
         /* Not required, since fds[0] has CLOEXEC enabled anyway */
-        close(fds[0]);
+        pa_assert_se(pa_close(fds[0]) == 0);
 
         if (c->spawn_api.atfork)
             c->spawn_api.atfork();
@@ -571,7 +571,7 @@
         goto fail;
     }
 
-    close(fds[1]);
+    pa_assert_se(pa_close(fds[1]) == 0);
 
     c->is_local = 1;
 
@@ -586,9 +586,9 @@
 
 fail:
     if (fds[0] != -1)
-        close(fds[0]);
+        pa_assert_se(pa_close(fds[0]) == 0);
     if (fds[1] != -1)
-        close(fds[1]);
+        pa_assert_se(pa_close(fds[1]) == 0);
 
     unlock_autospawn_lock_file(c);
 

Modified: branches/lennart/src/pulse/mainloop.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulse/mainloop.c?rev=1811&root=pulseaudio&r1=1810&r2=1811&view=diff
==============================================================================
--- branches/lennart/src/pulse/mainloop.c (original)
+++ branches/lennart/src/pulse/mainloop.c Wed Sep 12 02:04:21 2007
@@ -606,9 +606,9 @@
     pa_xfree(m->pollfds);
 
     if (m->wakeup_pipe[0] >= 0)
-        close(m->wakeup_pipe[0]);
+        pa_assert_se(pa_close(m->wakeup_pipe[0]) == 0);
     if (m->wakeup_pipe[1] >= 0)
-        close(m->wakeup_pipe[1]);
+        pa_assert_se(pa_close(m->wakeup_pipe[1]) == 0);
 
     pa_xfree(m);
 }

Modified: branches/lennart/src/pulsecore/authkey.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/authkey.c?rev=1811&root=pulseaudio&r1=1810&r2=1811&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/authkey.c (original)
+++ branches/lennart/src/pulsecore/authkey.c Wed Sep 12 02:04:21 2007
@@ -120,7 +120,10 @@
         if (unlock)
             pa_lock_fd(fd, 0);
 
-        close(fd);
+        if (pa_close(fd) < 0) {
+            pa_log_warn("Failed to close cookie file: %s", pa_cstrerror(errno));
+            ret = -1;
+        }
     }
 
     return ret;
@@ -221,7 +224,10 @@
         if (unlock)
             pa_lock_fd(fd, 0);
 
-        close(fd);
+        if (pa_close(fd) < 0) {
+            pa_log_warn("Failed to close cookie file: %s", pa_cstrerror(errno));
+            ret = -1;
+        }
     }
 
     return ret;

Modified: branches/lennart/src/pulsecore/core-util.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/core-util.c?rev=1811&root=pulseaudio&r1=1810&r2=1811&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/core-util.c (original)
+++ branches/lennart/src/pulsecore/core-util.c Wed Sep 12 02:04:21 2007
@@ -360,11 +360,11 @@
 /** Platform independent read function. Necessary since not all
  * systems treat all file descriptors equal. */
 int pa_close(int fd) {
+
 #ifdef OS_IS_WIN32
     int ret;
 
-    ret = closesocket(fd);
-    if (ret == 0)
+    if ((ret = closesocket(fd)) == 0)
         return 0;
 
     if (WSAGetLastError() != WSAENOTSOCK) {
@@ -838,8 +838,7 @@
             return 0;
     }
 
-    pa_log("%slock: %s", !b? "un" : "",
-        pa_cstrerror(errno));
+    pa_log("%slock: %s", !b? "un" : "", pa_cstrerror(errno));
 #endif
 
 #ifdef OS_IS_WIN32
@@ -873,32 +872,33 @@
         struct stat st;
 
         if ((fd = open(fn, O_CREAT|O_RDWR, S_IRUSR|S_IWUSR)) < 0) {
-            pa_log("failed to create lock file '%s': %s", fn,
-                pa_cstrerror(errno));
+            pa_log_warn("Failed to create lock file '%s': %s", fn, pa_cstrerror(errno));
             goto fail;
         }
 
         if (pa_lock_fd(fd, 1) < 0) {
-            pa_log("failed to lock file '%s'.", fn);
+            pa_log_warn("Failed to lock file '%s'.", fn);
             goto fail;
         }
 
         if (fstat(fd, &st) < 0) {
-            pa_log("failed to fstat() file '%s'.", fn);
+            pa_log_warn("Failed to fstat() file '%s': %s", fn, pa_cstrerror(errno));
             goto fail;
         }
 
-        /* Check wheter the file has been removed meanwhile. When yes, restart this loop, otherwise, we're done */
+        /* Check wheter the file has been removed meanwhile. When yes,
+         * restart this loop, otherwise, we're done */
         if (st.st_nlink >= 1)
             break;
 
         if (pa_lock_fd(fd, 0) < 0) {
-            pa_log("failed to unlock file '%s'.", fn);
+            pa_log_warn("Failed to unlock file '%s'.", fn);
             goto fail;
         }
 
-        if (close(fd) < 0) {
-            pa_log("failed to close file '%s'.", fn);
+        if (pa_close(fd) < 0) {
+            pa_log_warn("Failed to close file '%s': %s", fn, pa_cstrerror(errno));
+            fd = -1;
             goto fail;
         }
 
@@ -910,7 +910,7 @@
 fail:
 
     if (fd >= 0)
-        close(fd);
+        pa_close(fd);
 
     return -1;
 }
@@ -922,19 +922,17 @@
     pa_assert(fd >= 0);
 
     if (unlink(fn) < 0) {
-        pa_log_warn("WARNING: unable to remove lock file '%s': %s",
-            fn, pa_cstrerror(errno));
+        pa_log_warn("Unable to remove lock file '%s': %s", fn, pa_cstrerror(errno));
         r = -1;
     }
 
     if (pa_lock_fd(fd, 0) < 0) {
-        pa_log_warn("WARNING: failed to unlock file '%s'.", fn);
+        pa_log_warn("Failed to unlock file '%s'.", fn);
         r = -1;
     }
 
-    if (close(fd) < 0) {
-        pa_log_warn("WARNING: failed to close lock file '%s': %s",
-            fn, pa_cstrerror(errno));
+    if (pa_close(fd) < 0) {
+        pa_log_warn("Failed to close '%s': %s", fn, pa_cstrerror(errno));
         r = -1;
     }
 

Modified: branches/lennart/src/pulsecore/fdsem.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/fdsem.c?rev=1811&root=pulseaudio&r1=1810&r2=1811&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/fdsem.c (original)
+++ branches/lennart/src/pulsecore/fdsem.c Wed Sep 12 02:04:21 2007
@@ -67,8 +67,8 @@
 void pa_fdsem_free(pa_fdsem *f) {
     pa_assert(f);
 
-    close(f->fds[0]);
-    close(f->fds[1]);
+    pa_assert_se(pa_close(f->fds[0]) == 0);
+    pa_assert_se(pa_close(f->fds[1]) == 0);
 
     pa_xfree(f);
 }

Modified: branches/lennart/src/pulsecore/pid.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/pid.c?rev=1811&root=pulseaudio&r1=1810&r2=1811&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/pid.c (original)
+++ branches/lennart/src/pulsecore/pid.c Wed Sep 12 02:04:21 2007
@@ -61,8 +61,7 @@
     pa_assert(fd >= 0);
 
     if ((r = pa_loop_read(fd, t, sizeof(t)-1, NULL)) < 0) {
-        pa_log_warn("WARNING: failed to read PID file '%s': %s",
-            fn, pa_cstrerror(errno));
+        pa_log_warn("Failed to read PID file '%s': %s", fn, pa_cstrerror(errno));
         return (pid_t) -1;
     }
 
@@ -74,7 +73,7 @@
         *e = 0;
 
     if (pa_atou(t, &pid) < 0) {
-        pa_log_warn("WARNING: failed to parse PID file '%s'", fn);
+        pa_log_warn("Failed to parse PID file '%s'", fn);
         return (pid_t) -1;
     }
 
@@ -91,8 +90,7 @@
 
         if ((fd = open(fn, mode, S_IRUSR|S_IWUSR)) < 0) {
             if (mode != O_RDONLY || errno != ENOENT)
-                pa_log_warn("WARNING: failed to open PID file '%s': %s",
-                    fn, pa_cstrerror(errno));
+                pa_log_warn("WARNING: failed to open PID file '%s': %s", fn, pa_cstrerror(errno));
             goto fail;
         }
 
@@ -101,8 +99,7 @@
             goto fail;
 
         if (fstat(fd, &st) < 0) {
-            pa_log_warn("WARNING: failed to fstat() PID file '%s': %s",
-                fn, pa_cstrerror(errno));
+            pa_log_warn("Failed to fstat() PID file '%s': %s", fn, pa_cstrerror(errno));
             goto fail;
         }
 
@@ -113,9 +110,9 @@
         if (pa_lock_fd(fd, 0) < 0)
             goto fail;
 
-        if (close(fd) < 0) {
-            pa_log_warn("WARNING: failed to close file '%s': %s",
-                fn, pa_cstrerror(errno));
+        if (pa_close(fd) < 0) {
+            pa_log_warn("Failed to close file '%s': %s", fn, pa_cstrerror(errno));
+            fd = -1;
             goto fail;
         }
 
@@ -128,7 +125,7 @@
 
     if (fd >= 0) {
         pa_lock_fd(fd, 0);
-        close(fd);
+        pa_close(fd);
     }
 
     return -1;
@@ -153,7 +150,7 @@
         goto fail;
 
     if ((pid = read_pid(fn, fd)) == (pid_t) -1)
-        pa_log("corrupt PID file, overwriting.");
+        pa_log_warn("Corrupt PID file, overwriting.");
     else if (pid > 0) {
 #ifdef OS_IS_WIN32
         if ((process = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid)) != NULL) {
@@ -161,17 +158,16 @@
 #else
         if (kill(pid, 0) >= 0 || errno != ESRCH) {
 #endif
-            pa_log("daemon already running.");
-            goto fail;
-        }
-
-        pa_log("stale PID file, overwriting.");
+            pa_log("Daemon already running.");
+            goto fail;
+        }
+
+        pa_log_warn("Stale PID file, overwriting.");
     }
 
     /* Overwrite the current PID file */
     if (lseek(fd, 0, SEEK_SET) == (off_t) -1 || ftruncate(fd, 0) < 0) {
-        pa_log("failed to truncate PID file '%s': %s",
-            fn, pa_cstrerror(errno));
+        pa_log("Failed to truncate PID file '%s': %s", fn, pa_cstrerror(errno));
         goto fail;
     }
 
@@ -179,7 +175,7 @@
     l = strlen(t);
 
     if (pa_loop_write(fd, t, l, NULL) != (ssize_t) l) {
-        pa_log("failed to write PID file.");
+        pa_log("Failed to write PID file.");
         goto fail;
     }
 
@@ -188,7 +184,11 @@
 fail:
     if (fd >= 0) {
         pa_lock_fd(fd, 0);
-        close(fd);
+        
+        if (pa_close(fd) < 0) {
+            pa_log("Failed to close PID file '%s': %s", fn, pa_cstrerror(errno));
+            ret = -1;
+        }
     }
 
     return ret;
@@ -213,13 +213,12 @@
         goto fail;
 
     if (pid != getpid()) {
-        pa_log("WARNING: PID file '%s' not mine!", fn);
+        pa_log("PID file '%s' not mine!", fn);
         goto fail;
     }
 
     if (ftruncate(fd, 0) < 0) {
-        pa_log_warn("WARNING: failed to truncate PID file '%s': %s",
-            fn, pa_cstrerror(errno));
+        pa_log_warn("Failed to truncate PID file '%s': %s", fn, pa_cstrerror(errno));
         goto fail;
     }
 
@@ -230,8 +229,7 @@
 #endif
 
     if (unlink(fn) < 0) {
-        pa_log_warn("WARNING: failed to remove PID file '%s': %s",
-            fn, pa_cstrerror(errno));
+        pa_log_warn("Failed to remove PID file '%s': %s", fn, pa_cstrerror(errno));
         goto fail;
     }
 
@@ -241,7 +239,11 @@
 
     if (fd >= 0) {
         pa_lock_fd(fd, 0);
-        pa_assert_se(close(fd) == 0);
+
+        if (pa_close(fd) < 0) {
+            pa_log_warn("Failed to close PID file '%s': %s", fn, pa_cstrerror(errno));
+            ret = -1;
+        }
     }
 
     return ret;
@@ -283,7 +285,7 @@
 
     if (fd >= 0) {
         pa_lock_fd(fd, 0);
-        pa_assert_se(close(fd) == 0);
+        pa_close(fd);
     }
 
     return ret;

Modified: branches/lennart/src/pulsecore/random.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/random.c?rev=1811&root=pulseaudio&r1=1810&r2=1811&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/random.c (original)
+++ branches/lennart/src/pulsecore/random.c Wed Sep 12 02:04:21 2007
@@ -69,7 +69,7 @@
             if ((r = pa_loop_read(fd, ret_data, length, NULL)) < 0 || (size_t) r != length)
                 ret = -1;
 
-            close(fd);
+            pa_close(fd);
         } else
             ret = -1;
 

Modified: branches/lennart/src/pulsecore/shm.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/shm.c?rev=1811&root=pulseaudio&r1=1810&r2=1811&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/shm.c (original)
+++ branches/lennart/src/pulsecore/shm.c Wed Sep 12 02:04:21 2007
@@ -154,7 +154,7 @@
         pa_atomic_store(&marker->pid, (int) getpid());
         pa_atomic_store(&marker->marker, SHM_MARKER);
         
-        close(fd);
+        pa_assert_se(close(fd) == 0);
         m->do_unlink = 1;
 #else
         return -1;
@@ -170,7 +170,7 @@
 #ifdef HAVE_SHM_OPEN
     if (fd >= 0) {
         shm_unlink(fn);
-        pa_assert_se(close(fd) >= 0);
+        pa_close(fd);
     }
 #endif
 
@@ -297,13 +297,13 @@
     m->do_unlink = 0;
     m->shared = 1;
 
-    pa_assert_se(close(fd) >= 0);
+    pa_assert_se(pa_close(fd) == 0);
 
     return 0;
 
 fail:
     if (fd >= 0)
-        pa_assert_se(close(fd) >= 0);
+        pa_close(fd);
 
     return -1;
 }

Modified: branches/lennart/src/pulsecore/sound-file-stream.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/sound-file-stream.c?rev=1811&root=pulseaudio&r1=1810&r2=1811&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/sound-file-stream.c (original)
+++ branches/lennart/src/pulsecore/sound-file-stream.c Wed Sep 12 02:04:21 2007
@@ -40,6 +40,7 @@
 #include <pulsecore/sink-input.h>
 #include <pulsecore/log.h>
 #include <pulsecore/thread-mq.h>
+#include <pulsecore/core-util.h>
 
 #include "sound-file-stream.h"
 
@@ -271,7 +272,7 @@
     
     if (!(u->sndfile = sf_open_fd(fd, SFM_READ, &sfinfo, 1))) {
         pa_log("Failed to open file %s", fname);
-        close(fd);
+        pa_close(fd);
         goto fail;
     }
 

Modified: branches/lennart/src/pulsecore/sound-file.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/sound-file.c?rev=1811&root=pulseaudio&r1=1810&r2=1811&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/sound-file.c (original)
+++ branches/lennart/src/pulsecore/sound-file.c Wed Sep 12 02:04:21 2007
@@ -36,6 +36,7 @@
 #include <pulsecore/log.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/core-error.h>
+#include <pulsecore/core-util.h>
 
 #include "sound-file.h"
 #include "core-scache.h"
@@ -77,7 +78,7 @@
     
     if (!(sf = sf_open_fd(fd, SFM_READ, &sfinfo, 1))) {
         pa_log("Failed to open file %s", fname);
-        close(fd);
+        pa_close(fd);
         goto finish;
     }
 




More information about the pulseaudio-commits mailing list