Bugzilla – Bug 279
Bad return value for ldns_udp_connect and ldns_tcp_connect
Last modified: 2014-06-17 10:28:50 CEST
Both ldns_udp_connect and ldns_tcp_connect return 0 if the socket could not be created. This makes it impossible to correctly detect errors as 0 is a valid fd and could be returned after close(0).
You are completely correct but this needs a public API change. To return -1 on error perhaps.
Thanks for the report, Wouter
Additionally affected are ldns_udp_bgsend and ldns_tcp_bgsend by transitive closure.
I can't find any third packages as the moment that depend on ldns.