From 60d29a9fefe6ef6c79052adb74e6458dd87d5877 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 22 May 2002 21:40:14 +0000 Subject: Fix for strangeness in Linux 2.0.x select return. Jeremy. (This used to be commit 490b95a35d1e2ccd3b80db5cfcf7b9804901d36e) --- source3/smbd/oplock.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index e01b1b3e7e..6a47791300 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -98,6 +98,20 @@ BOOL receive_local_message( char *buffer, int buffer_len, int timeout) selrtn = sys_select(maxfd+1,&fds,NULL,NULL,&to); if (selrtn == -1 && errno == EINTR) { + + /* + * Linux 2.0.x seems to have a bug in that + * it can return -1, EINTR with a timeout of zero. + * Make sure we bail out here with a read timeout + * if we got EINTR on a timeout of 1 or less. + */ + + if (timeout <= 1) { + smb_read_error = READ_TIMEOUT; + return False; + } + + /* could be a kernel oplock interrupt */ if (koplocks && koplocks->msg_waiting(&fds)) { return koplocks->receive_message(&fds, buffer, buffer_len); -- cgit