Bug 1034140 - Eat unused write() and read() return values. r=padenot
authorChris Peterson <cpeterson@mozilla.com>
Fri, 04 Jul 2014 12:00:07 -0700
changeset 193236 f97c7b5e2994ef363cef6731ed3587c8045bed26
parent 193235 4157f51c6ad4c9c6f2ce64a7179e2b2563ef35c5
child 193237 b9c4f3960eb2cbaf9c484dcaa38092bb38f72ff3
push id27112
push usercbook@mozilla.com
push dateThu, 10 Jul 2014 12:47:23 +0000
treeherdermozilla-central@6e9f72bdd32e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1034140
milestone33.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1034140 - Eat unused write() and read() return values. r=padenot
media/libcubeb/src/cubeb_alsa.c
--- a/media/libcubeb/src/cubeb_alsa.c
+++ b/media/libcubeb/src/cubeb_alsa.c
@@ -215,17 +215,19 @@ rebuild(cubeb * ctx)
   }
 
   ctx->rebuild = 0;
 }
 
 static void
 poll_wake(cubeb * ctx)
 {
-  write(ctx->control_fd_write, "x", 1);
+  if (write(ctx->control_fd_write, "x", 1) < 0) {
+    /* ignore write error */
+  }
 }
 
 static void
 set_timeout(struct timeval * timeout, unsigned int ms)
 {
   gettimeofday(timeout, NULL);
   timeout->tv_sec += ms / 1000;
   timeout->tv_usec += (ms % 1000) * 1000;
@@ -367,17 +369,19 @@ alsa_run(cubeb * ctx)
   }
 
   pthread_mutex_unlock(&ctx->mutex);
   r = poll(ctx->fds, ctx->nfds, timeout);
   pthread_mutex_lock(&ctx->mutex);
 
   if (r > 0) {
     if (ctx->fds[0].revents & POLLIN) {
-      read(ctx->control_fd_read, &dummy, 1);
+      if (read(ctx->control_fd_read, &dummy, 1) < 0) {
+        /* ignore read error */
+      }
 
       if (ctx->shutdown) {
         pthread_mutex_unlock(&ctx->mutex);
         return -1;
       }
     }
 
     for (i = 0; i < CUBEB_STREAM_MAX; ++i) {