]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
fixed a bug in handling select in the main daemon - this stops the daemon spinning...
authorAndrew Tridgell <tridge@samba.org>
Tue, 25 Jun 2002 00:59:14 +0000 (00:59 +0000)
committerAndrew Tridgell <tridge@samba.org>
Tue, 25 Jun 2002 00:59:14 +0000 (00:59 +0000)
source/lib/select.c

index efcf63becca575e6d6bb05f97fea13202b372b40..f88ad52de65e5ce4ac40b9dcd84ad6ff1e66a9b7 100644 (file)
@@ -102,6 +102,12 @@ int sys_select(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorfds, s
        }
 
        if (FD_ISSET(select_pipe[0], readfds2)) {
+               char c;
+               saved_errno = errno;
+               if (read(select_pipe[0], &c, 1) == 1) {
+                       pipe_read++;
+               }
+               errno = saved_errno;
                FD_CLR(select_pipe[0], readfds2);
                ret--;
                if (ret == 0) {
@@ -110,18 +116,6 @@ int sys_select(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorfds, s
                }
        }
 
-       saved_errno = errno;
-
-       while (pipe_written != pipe_read) {
-               char c;
-               /* Due to the linux kernel bug in 2.0.x, we
-                * always increment here even if the read failed... */
-               read(select_pipe[0], &c, 1);
-               pipe_read++;
-       }
-
-       errno = saved_errno;
-
        return ret;
 }