Charles Lepple
2007-Mar-12 02:16 UTC
[Nut-upsdev] infinite loop in clients/upsclient.c connect
I was testing some code for listing available UPSes, and when I tried connecting to a machine that didn't have upsd running, upsc went into an infinite loop on OS X (IPv6 enabled). The error code returned by connect is EINVAL, which apparently isn't one of the errors documented in connect(2) here. http://boxster.ghz.cc/projects/nut/changeset/731 http://boxster.ghz.cc/projects/nut/browser/trunk/clients/upsclient.c?rev=731#L540 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. Also, EINTR is most likely going to be generated by a signal, and the only unmasked signal that we can reasonably expect is SIGINT (which *should* terminate upsc). -- - Charles Lepple
Arjen de Korte
2007-Mar-12 08:32 UTC
[Nut-upsdev] infinite loop in clients/upsclient.c connect
> 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. Best regards, Arjen