[Nut-upsdev] infinite loop in clients/upsclient.c connect

Arjen de Korte nut+devel at de-korte.org
Mon Mar 12 15:42:27 CET 2007


>>> I'm not sure about the logic inside the switch statement in general,
>>> actually. If the error is EAFNOSUPPORT, I would think we would need
>>> more than just to break out of the switch statement.
>> Yes, I goofed up BIG TIME here. We should really move to the next
>> addrinfo element, rather than retrying connect() ad infinum. I'll post an
>> update later today.
> Ah, multiple addrinfo elements makes sense now. I was wondering what
> was going on there :-)

It's actually a linked list of addrinfo elements. Most of the time an
error means you'll have to move on to the next item on the list, but
sometimes you'll just need to retry the existing one. What was missing was
a break statement after the switch statement. Instead of terminating the
while loop in case of an error, it will now keep trying forever. Not
good... :-(

Best regards, Arjen




More information about the Nut-upsdev mailing list