]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Check and act on return values from write()
authorAndreas Öman <andreas@lonelycoder.com>
Wed, 4 May 2011 11:45:31 +0000 (13:45 +0200)
committerAndreas Öman <andreas@lonelycoder.com>
Wed, 4 May 2011 11:45:31 +0000 (13:45 +0200)
src/cwc.c
src/htsp.c

index 408b0d5fff0d71ed38f7d3013ee61a5eb20dc9b9..1c9eeb11129c47c4e664d9bf392bcc3154d1acf9 100644 (file)
--- a/src/cwc.c
+++ b/src/cwc.c
@@ -484,6 +484,9 @@ cwc_send_msg(cwc_t *cwc, const uint8_t *msg, size_t len, int sid, int enq)
     pthread_mutex_unlock(&cwc->cwc_writer_mutex);
   } else {
     n = write(cwc->cwc_fd, buf, len);
+    if(n != len)
+      tvhlog(LOG_INFO, "cwc", "write error %s", strerror(errno));
+
     free(cm);
   }
   return seq & 0xffff;
index 09c9580e04d99aa3c22b26691946b7c613e2376b..608b5001ae5968f44860026e7686f65df3ed8e4e 100644 (file)
@@ -1248,8 +1248,13 @@ htsp_write_scheduler(void *aux)
    
     /* ignore return value */ 
     r = write(htsp->htsp_fd, dptr, dlen);
+    if(r != dlen)
+      tvhlog(LOG_INFO, "htsp", "%s: Write error -- %s", 
+            htsp->htsp_logname, strerror(errno));
     free(dptr);
     pthread_mutex_lock(&htsp->htsp_out_mutex);
+    if(r != dlen) 
+      break;
   }
 
   pthread_mutex_unlock(&htsp->htsp_out_mutex);