Bug 465435: added a comment to explain the check against FD_SETSIZE in
authorwtc%google.com
Fri, 21 Nov 2008 21:22:28 +0000
changeset 4015 420d87ca17c073dfefbbdf82bffdfddeaae0ab1b
parent 4014 3a269221a6f7a2db77aa92da5aa1782c0de89f21
child 4016 7631262469d0d32999289f6f449945634f357eba
push idunknown
push userunknown
push dateunknown
bugs465435
Bug 465435: added a comment to explain the check against FD_SETSIZE in _PR_MD_PR_POLL. r=aleksey.sanin.
pr/src/md/windows/w32poll.c
--- a/pr/src/md/windows/w32poll.c
+++ b/pr/src/md/windows/w32poll.c
@@ -242,16 +242,22 @@ PRInt32 _PR_MD_PR_POLL(PRPollDesc *pds, 
         else
         {
             pd->out_flags = 0;
         }
     }
 
     if (0 != ready) return ready;  /* no need to block */
 
+    /*
+     * FD_SET does nothing if the fd_set's internal fd_array is full.  If
+     * nrd, nwt, or nex is greater than FD_SETSIZE, we know FD_SET must
+     * have failed to insert an osfd into the corresponding fd_set, and
+     * therefore we should fail.
+     */
     if ((nrd > FD_SETSIZE) || (nwt > FD_SETSIZE) || (nex > FD_SETSIZE)) {
         PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
         return -1;
     }
 
     rdp = (0 == nrd) ? NULL : &rd;
     wtp = (0 == nwt) ? NULL : &wt;
     exp = (0 == nex) ? NULL : &ex;