continue;
}
+
if (n == 0) {
if (eof_error) {
rprintf(FERROR,"unexpected EOF in read_timeout\n");
exit_cleanup(RERR_STREAMIO);
}
+ /* this prevents us trying to write errors on a dead socket */
+ io_multiplexing_out = 0;
+
rprintf(FERROR,"read error: %s\n", strerror(errno));
exit_cleanup(RERR_STREAMIO);
}
}
if (FD_ISSET(fd, &w_fds)) {
- int n = len-total;
- int ret = write(fd,buf+total,n?n:1);
+ int ret, n = len-total;
+
+ if (n > PIPE_BUF) n = PIPE_BUF;
+
+ ret = write(fd,buf+total,n?n:1);
if (ret == -1 && errno == EINTR) {
continue;