ev.c fix

Denis F. Latypoff latypoff at yandex.ru
Wed Sep 7 11:37:28 CEST 2011


07.09.2011, 12:35, "Auxten wpc" <auxtenwpc at gmail.com>:
> libev-4.04 may have a infi loop at ev.c line 1020,1019
>
>>           for (w = (ev_io *)anfd->head; w; w = (ev_io *)((WL)w)->next)
>>               anfd->events |= (unsigned char)w->events;
>
> as my trace there a possiblity "w == (ev_io *)((WL)w)->next", the next point to itself
> this cause one of my threads infi loop here, so the simple fix is
>
> diff -r libev-4.04/ev.c libev-4.04-fixed/ev.c
>> 1020c1020,1024
>> <             anfd->events |= (unsigned char)w->events;
>> ---
>>>             {
>>>               anfd->events |= (unsigned char)w->events;
>>>               if (w == (ev_io *)((WL)w)->next)
>>>                 break;
>>>             }
>

Patch is useless. In normal there is no case when w == w->next.
Check if you call ev_io_start () twice for the same watcher in a row.
That may cause infinite loop.

-- 
br, Denis F. Latypoff.



More information about the libev mailing list