summaryrefslogtreecommitdiff
path: root/source3/lib/wb_reqtrans.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-05-22 19:29:46 +0200
committerVolker Lendecke <vl@samba.org>2009-05-24 13:50:35 +0200
commite337124c555aee32f0d075b8008c77da3065c1e1 (patch)
tree295b3e0b078dbb40018306ee9bc55c6593387d49 /source3/lib/wb_reqtrans.c
parent6492ffd8df0d8bd847c977396edd070b8be65f54 (diff)
downloadsamba-e337124c555aee32f0d075b8008c77da3065c1e1.tar.gz
samba-e337124c555aee32f0d075b8008c77da3065c1e1.tar.bz2
samba-e337124c555aee32f0d075b8008c77da3065c1e1.zip
Fix closed_fd(): select returning 0 means no fd listening
Diffstat (limited to 'source3/lib/wb_reqtrans.c')
-rw-r--r--source3/lib/wb_reqtrans.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/source3/lib/wb_reqtrans.c b/source3/lib/wb_reqtrans.c
index 16d71fe03e..038e5bda17 100644
--- a/source3/lib/wb_reqtrans.c
+++ b/source3/lib/wb_reqtrans.c
@@ -342,6 +342,7 @@ static bool closed_fd(int fd)
{
struct timeval tv;
fd_set r_fds;
+ int selret;
if (fd == -1) {
return true;
@@ -351,12 +352,14 @@ static bool closed_fd(int fd)
FD_SET(fd, &r_fds);
ZERO_STRUCT(tv);
- if ((select(fd+1, &r_fds, NULL, NULL, &tv) == -1)
- || FD_ISSET(fd, &r_fds)) {
+ selret = select(fd+1, &r_fds, NULL, NULL, &tv);
+ if (selret == -1) {
return true;
}
-
- return false;
+ if (selret == 0) {
+ return false;
+ }
+ return (FD_ISSET(fd, &r_fds));
}
struct wb_simple_trans_state {