r15675: Man pages say never look at the fd_set after a select
authorJeremy Allison <jra@samba.org>
Thu, 18 May 2006 01:45:18 +0000 (01:45 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:17:06 +0000 (11:17 -0500)
if it returned -1 (treat as undefined). Ensure we obey
this.
Jeremy.

source/nsswitch/winbindd.c

index 06b8b93543744216dfaa3e8938861ba50e95df6f..cc904c3209185b0ecaec84ceaa6ac9d7dc494b1b 100644 (file)
@@ -769,10 +769,14 @@ static void process_loop(void)
         
        selret = sys_select(maxfd + 1, &r_fds, &w_fds, NULL, &timeout);
 
-       if (selret == 0)
+       if (selret == 0) {
                goto no_fds_ready;
+       }
 
-       if ((selret == -1 && errno != EINTR) || selret == 0) {
+       if (selret == -1) {
+               if (errno == EINTR) {
+                       goto no_fds_ready;
+               }
 
                /* Select error, something is badly wrong */
 
@@ -780,6 +784,8 @@ static void process_loop(void)
                exit(1);
        }
 
+       /* selret > 0 */
+
        ev = fd_events;
        while (ev != NULL) {
                struct fd_event *next = ev->next;