Roy T. Fielding wrote:

The warning is simply because gcc can't follow conditionals, but
this should be a safe fix if nobody minds.


I think an even safer fix would be to turn that last
"else if" into an "else."  If we just initialize the
value to zero, we might end up polling fd 0 if a
caller passes in an array full of invalid desc_type
values (such that none of the current if-conditions
are true).

I just noticed that we also need to avoid changing
"num" in that last else-if, because the malloc/free
version of the ifdefs depends on the original value.
I'll commit a fix this afternoon.

Brian


....Roy

Index: poll.c
===================================================================
RCS file: /home/cvs/apr/poll/unix/poll.c,v
retrieving revision 1.28
diff -u -r1.28 poll.c
--- poll.c      7 Aug 2002 00:06:12 -0000       1.28
+++ poll.c      10 Aug 2002 03:03:13 -0000
@@ -212,7 +212,7 @@
     FD_ZERO(&exceptset);

     for (i = 0; i < num; i++) {
-        apr_os_sock_t fd;
+        apr_os_sock_t fd = 0;

         if (aprset[i].desc_type == APR_POLL_SOCKET) {
 #ifdef NETWARE






Reply via email to