[PATCH] Improve NNTPconnect error reporting

Ian Jackson ijackson at chiark.greenend.org.uk
Sun Jun 6 22:09:00 UTC 2010

Russ Allbery writes ("Re: [PATCH] Improve NNTPconnect error reporting"):
> 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.

Also, with any connection routine like this that tries multiple
addresses and address families, there's a question about which errno
value to report, which leads to slightly obscure logic about saving
and restoring errnos.  Another possibility would be to allow the
caller to specify a callback function which gets told either a string,
or some more information including h_errno or errno or what have you,
and might be called more than once.

> 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.

I think the string buffer is probably least ugly but tell me what you
think is best and I'll code it up.


More information about the inn-workers mailing list