changeset 110617:4e2238ed599f

* xgselect.c (xg_select): Clear file descriptors not set from rfds and wfds.
author Jan D <jan.h.d@swipnet.se>
date Sun, 26 Sep 2010 17:39:10 +0200
parents cb4b54af7023
children 7019133063c8 75fb6d1241c3
files src/ChangeLog src/xgselect.c
diffstat 2 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sun Sep 26 02:37:50 2010 +0200
+++ b/src/ChangeLog	Sun Sep 26 17:39:10 2010 +0200
@@ -1,3 +1,8 @@
+2010-09-26  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* xgselect.c (xg_select): Clear file descriptors not set from
+	rfds and wfds.
+
 2010-09-21  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* syntax.c (back_comment): Detect the case where a 1-char comment
--- a/src/xgselect.c	Sun Sep 26 02:37:50 2010 +0200
+++ b/src/xgselect.c	Sun Sep 26 17:39:10 2010 +0200
@@ -113,11 +113,17 @@
               if (rfds && FD_ISSET (i, rfds)) ++retval;
               else ++our_fds;
             }
+          else if (rfds)
+            FD_CLR (i, rfds);
+
           if (have_wfds && FD_ISSET (i, &all_wfds))
             {
               if (wfds && FD_ISSET (i, wfds)) ++retval;
               else ++our_fds;
             }
+          else if (wfds)
+            FD_CLR (i, wfds);
+
           if (efds && FD_ISSET (i, efds))
             ++retval;
         }