From a7026ba90ac1e4a87cd57e9a02dd342d00410f52 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Wed, 23 Jun 2004 01:13:09 +0000 Subject: [PATCH] Fixed a newly-introduced problem in read_timeout() where FD_ZERO(&w_fds) wasn't always called before w_fds was used. --- io.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/io.c b/io.c index ef4735c4..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,9 +414,7 @@ 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) { if (errno == EBADF) -- 2.34.1