]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Correctly deal with return value from write()
authorAndreas Öman <andreas@lonelycoder.com>
Fri, 1 Apr 2011 13:32:07 +0000 (15:32 +0200)
committerAndreas Öman <andreas@lonelycoder.com>
Fri, 1 Apr 2011 13:32:07 +0000 (15:32 +0200)
src/tcp.c

index 171a4dc659565856796e708a9d3c856bc548dc94..27ed5602f655caee96e6d1650e2b2d600c720129 100644 (file)
--- a/src/tcp.c
+++ b/src/tcp.c
@@ -181,18 +181,18 @@ int
 tcp_write_queue(int fd, htsbuf_queue_t *q)
 {
   htsbuf_data_t *hd;
-  int l, r;
+  int l, r = 0;
 
   while((hd = TAILQ_FIRST(&q->hq_q)) != NULL) {
     TAILQ_REMOVE(&q->hq_q, hd, hd_link);
 
     l = hd->hd_data_len - hd->hd_data_off;
-    r write(fd, hd->hd_data + hd->hd_data_off, l);
+    r |= !!write(fd, hd->hd_data + hd->hd_data_off, l);
     free(hd->hd_data);
     free(hd);
   }
   q->hq_size = 0;
-  return 0;
+  return r;
 }