From: Andreas Ă–man Date: Wed, 4 May 2011 11:45:31 +0000 (+0200) Subject: Check and act on return values from write() X-Git-Tag: 2.99~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24b7b2ed15c72edb27c1259545cc7c164c9cd6dd;p=thirdparty%2Ftvheadend.git Check and act on return values from write() --- diff --git a/src/cwc.c b/src/cwc.c index 408b0d5ff..1c9eeb111 100644 --- 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; diff --git a/src/htsp.c b/src/htsp.c index 09c9580e0..608b5001a 100644 --- a/src/htsp.c +++ b/src/htsp.c @@ -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);