[Ffmpeg-devel] poll() emulation for ffserver
matthieu castet
castet.matthieu
Wed Feb 14 19:46:02 CET 2007
matthieu castet wrote:
> Hi,
>
> Fran?ois Revol wrote:
>
>> +
>> + FD_ZERO(&read_set);
>> + FD_ZERO(&write_set);
>> + FD_ZERO(&exception_set);
>> +
>> + n = -1;
>> + for(i = 0; i < numfds; i++) {
>> + if (fds[i].fd < 0)
>> + continue;
>> +
>> + if (fds[i].events & POLLIN) FD_SET(fds[i].fd, &read_set);
>> + if (fds[i].events & POLLOUT) FD_SET(fds[i].fd, &write_set);
>> + if (fds[i].events & POLLERR) FD_SET(fds[i].fd, &exception_set);
> You you check if numfds >= FD_SETSIZE :
in fact it is fds[i].fd >= FD_SETSIZE
>
> man select
> [...]
> An fd_set is a fixed size buffer. Executing FD_CLR() or FD_SET() with
> a value of fd that is negative or is equal to or larger than FD_SETSIZE
> will result in undefined behavior. Moreover, POSIX requires fd to be a
> valid file descriptor.
>
>
More information about the ffmpeg-devel
mailing list