summaryrefslogtreecommitdiff
path: root/source3/lib/select.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib/select.c')
-rw-r--r--source3/lib/select.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source3/lib/select.c b/source3/lib/select.c
index 458642f57e..c654a4a02c 100644
--- a/source3/lib/select.c
+++ b/source3/lib/select.c
@@ -58,6 +58,21 @@ int sys_select(int maxfd, fd_set *fds,struct timeval *tval)
if (initialised != sys_getpid()) {
pipe(select_pipe);
+
+ /*
+ * These next two lines seem to fix a bug with the Linux
+ * 2.0.x kernel (and probably other UNIXes as well) where
+ * the one byte read below can block even though the
+ * select returned that there is data in the pipe and
+ * the pipe_written variable was incremented. Thanks to
+ * HP for finding this one. JRA.
+ */
+
+ if(set_blocking(select_pipe[0],0)==-1)
+ smb_panic("select_pipe[0]: O_NONBLOCK failed.\n");
+ if(set_blocking(select_pipe[1],0)==-1)
+ smb_panic("select_pipe[1]: O_NONBLOCK failed.\n");
+
initialised = sys_getpid();
}