apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Orton <jor...@redhat.com>
Subject Re: cvs commit: apr/poll/unix poll.c
Date Fri, 03 Jan 2003 16:05:22 GMT
On Tue, Dec 31, 2002 at 05:10:40PM -0000, William Rowe wrote:
>   Modified:    poll/unix poll.c
>   Log:
>     Fix apr_poll behavior on Darwin/Win32 (now passing testpoll.)
>     We were getting spurious returned events because the select-based
>     poll implementation wasn't zeroing out previous results before
>     setting the current ones and returning.
>   
>   Submitted by:	Garrett Rooney <rooneg@electricjellyfish.net>
>   
>   Revision  Changes    Path
>   1.33      +4 -0      apr/poll/unix/poll.c
>   --- poll.c	20 Sep 2002 10:42:37 -0000	1.32
>   +++ poll.c	31 Dec 2002 17:10:40 -0000	1.33
>   @@ -275,6 +275,10 @@
>        }
>    #endif
>    
>   +    for (i = 0; i < *nsds; i++) {
>   +      aprset[i].rtnevents = 0;
>   +    }
>   +
>        (*nsds) = rv;

I don't think this is correct; *nsds is a return value and isn't defined
until the following line, so this may cause i to overrun the array. (I'm
seeing memory corruption from this on some platforms)

Even so, why is this change necessary, since the for loop at the end of
the function is doing exactly the same thing already?

Regards,

joe

Mime
View raw message