Check and act on return values from write()
This commit is contained in:
parent
844deeb08b
commit
24b7b2ed15
2 changed files with 8 additions and 0 deletions
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue