[pulseaudio-discuss] [PATCH 5/5] mainloop: Check pa_write() return value.

Tanu Kaskinen tanu.kaskinen at digia.com
Mon Apr 2 05:01:06 PDT 2012


---
 src/pulse/mainloop.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/pulse/mainloop.c b/src/pulse/mainloop.c
index 8ac8f06..fe2966d 100644
--- a/src/pulse/mainloop.c
+++ b/src/pulse/mainloop.c
@@ -774,7 +774,10 @@ void pa_mainloop_wakeup(pa_mainloop *m) {
     char c = 'W';
     pa_assert(m);
 
-    pa_write(m->wakeup_pipe[1], &c, sizeof(c), &m->wakeup_pipe_type);
+    if (pa_write(m->wakeup_pipe[1], &c, sizeof(c), &m->wakeup_pipe_type) < 0)
+        /* Not much options for recovering from the error. Let's at least log something. */
+        pa_log("pa_write() failed while trying to wake up the mainloop: %s", pa_cstrerror(errno));
+
     pa_atomic_store(&m->wakeup_requested, TRUE);
 }
 
-- 
1.7.8



More information about the pulseaudio-discuss mailing list