malware@t-online.de (Michael Mueller) writes:
> Hi readers of linux-kernel and glibc maintainers,
>
> while hacking on a network application I found following oddity:
>
> poll(pds,nfds,timeout) called with one of the file descriptors listed in
> pds being invalid always does return nfds.
[snip .. ]
> Simple sample code demonstrating the problem:
When writing code, always compile with at least -Wall -W
>
> #include <stdio.h>
> #include <sys/poll.h>
>
> struct pollfd fds[] = {
> { 0, POLLIN, 0 },
> { 110, POLLIN, 0}
> };
>
> int main(void)
> {
> int r = poll(fds, sizeof fds / sizeof fds[0], -1);
> if ( r < 0 )
> perror("poll");
> else
> printf("poll returned %d\n");
printf("poll returned %d\n", r);
Is probably what you want.
>
> for ( r=0; r < sizeof fds / sizeof fds[0]; r++ )
> printf("revent[%d]: %hd\n", r, fds[r].revents);
>
> return 0;
> }
-- James Antill -- james@and.org Need an efficent and powerful string library for C? http://www.and.org/vstr/ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Wed Jul 23 2003 - 22:00:35 EST