Skip to content

Commit

Permalink
Fixed a newly-introduced problem in read_timeout() where FD_ZERO(&w_fds)
Browse files Browse the repository at this point in the history
wasn't always called before w_fds was used.
  • Loading branch information
Wayne Davison committed Jun 23, 2004
1 parent 3a69fad commit a7026ba
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}
Expand All @@ -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)
Expand Down

0 comments on commit a7026ba

Please sign in to comment.