Subject: Fwd: ARES_ECANCELLED overlaps ARES_ENOTINITIALIZED?

Fwd: ARES_ECANCELLED overlaps ARES_ENOTINITIALIZED?

From: John Engelhart <john.engelhart_at_gmail.com>
Date: Fri, 23 Oct 2009 03:29:50 -0400

(this is for the current source in CVS)

While doing some testing that happened to exercise ares_cancel, I noticed
that ares_strerror() was giving the following message for the canceled
queries:
Code=21 "c-ares library initialization not yet performed"

It seems that ares.h defines ARES_ECANCELLED and ARES_ENOTINITIALIZED as
such:

#define ARES_ECANCELLED 21
// ... snip ...
/* Uninitialized library error code */ #define ARES_ENOTINITIALIZED 21

Is this intentional? The current string that ares_strerror() returns is
clearly for ARES_ENOTINITIALIZED and not ARES_ECANCELLED. There's also the
small problem of not being able to distinguish between the two 'errors' in
code.

Can I suggest that ARES_ECANCELLED be assigned its own, distinct error
number and update ares_strerror.c accordingly? If this one got through, it's
probably worth a quick once over to see if anything else is doubly assigned.
Before I caught what the problem was, I ended up numbering all the strings
in ares_strerror.c, so it might be worthwhile to add to each error string in
ares_strerror.c a comment with its array position along with its associated
ARES_XXX symbol.
Received on 2009-10-23