Bug 279 - Bad return value for ldns_udp_connect and ldns_tcp_connect
Bad return value for ldns_udp_connect and ldns_tcp_connect
Product: ldns
Classification: Unclassified
Component: library
All All
: P2 normal
Assigned To: LDNS dev team
Depends on:
  Show dependency treegraph
Reported: 2009-10-26 22:13 CET by Joerg Sonnenberger
Modified: 2014-06-17 10:28 CEST (History)
3 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Joerg Sonnenberger 2009-10-26 22:13:31 CET
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).
Comment 1 Wouter Wijngaards 2009-10-27 16:04:06 CET
You are completely correct but this needs a public API change.  To return -1 on error perhaps.

Thanks for the report,   Wouter
Comment 2 Joerg Sonnenberger 2009-10-27 21:25:40 CET
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.