X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/c399d22a197c68c60f7ceaad5237f8a112b24abf..a7026ba90ac1e4a87cd57e9a02dd342d00410f52:/io.c diff --git a/io.c b/io.c index 13f4d3d1..421571a5 100644 --- a/io.c +++ b/io.c @@ -380,6 +380,7 @@ static int read_timeout(int fd, char *buf, size_t len) int count; FD_ZERO(&r_fds); + FD_ZERO(&w_fds); FD_SET(fd, &r_fds); if (msg_fd_in >= 0) { FD_SET(msg_fd_in, &r_fds); @@ -401,7 +402,6 @@ static int read_timeout(int fd, char *buf, size_t len) new_fd = -1; } } else { - FD_ZERO(&w_fds); FD_SET(io_filesfrom_f_out, &w_fds); new_fd = io_filesfrom_f_out; } @@ -414,14 +414,12 @@ static int read_timeout(int fd, char *buf, size_t len) errno = 0; - count = select(maxfd + 1, &r_fds, - io_filesfrom_buflen? &w_fds : NULL, - NULL, &tv); + count = select(maxfd + 1, &r_fds, &w_fds, NULL, &tv); if (count <= 0) { - check_timeout(); if (errno == EBADF) exit_cleanup(RERR_SOCKETIO); + check_timeout(); continue; } @@ -827,9 +825,9 @@ static void writefd_unbuffered(int fd,char *buf,size_t len) &w_fds, NULL, &tv); if (count <= 0) { - check_timeout(); if (count < 0 && errno == EBADF) exit_cleanup(RERR_SOCKETIO); + check_timeout(); continue; }