[PATCH] Improve NNTPconnect error reporting
rra at stanford.edu
Sat Jun 5 16:37:27 UTC 2010
Julien ÉLIE <julien at trigofacile.com> writes:
> It is now driven in network_connect_host() in lib/network.c
> ** Like network_connect, but takes a host and a port instead of an addrinfo
> ** struct list. Returns the file descriptor of the open socket on success,
> ** or -1 on failure. If getaddrinfo fails, errno may not be set to anything
> ** useful.
> and not directly in lib/remopen.c where we have:
> fd = network_connect_host(host, port, NULL);
> if (fd < 0)
> return -1;
> with no information from the getaddrinfo return code.
> The network API (headers in include/inn/network.h) would then need to be
> changed if we have to pass it a buffer to write the error.
> Is it advisable to do that?
It might be. That was always a really ugly wart in the network API and I
was cringing a bit when I wrote that last sentence in the introductory
comment. It's frustrating that there are two entirely separate error
reporting mechanisms between the system calls and the DNS lookups that
complicate passing errors back.
I think adding a buffer to hold the error is kind of ugly, but if it's the
only way to get the real error out, it might be worth it. I suppose we
could do something sneaky like return both positive and negative error
codes and distinguish between errno and h_errno that way, but that's
almost as ugly.
Russ Allbery (rra at stanford.edu) <http://www.eyrie.org/~eagle/>
Please send questions to the list rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
More information about the inn-workers