diff options
author | Yang Tse <yangsita@gmail.com> | 2011-03-22 13:43:34 +0100 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2011-03-22 13:43:34 +0100 |
commit | ef8e2ad6017a9e3a1d08b5f9e73d2bb0773cd1bb (patch) | |
tree | 292287f810258fa26aaa21fb33e6b36b6f974887 /ares_init.c | |
parent | cd753ffe140913979d8893f222c4c7ee272255a0 (diff) | |
download | c-ares-ef8e2ad6017a9e3a1d08b5f9e73d2bb0773cd1bb.tar.gz c-ares-ef8e2ad6017a9e3a1d08b5f9e73d2bb0773cd1bb.tar.bz2 c-ares-ef8e2ad6017a9e3a1d08b5f9e73d2bb0773cd1bb.zip |
ares_init: fix gethostname error detection on winsock platforms
Diffstat (limited to 'ares_init.c')
-rw-r--r-- | ares_init.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ares_init.c b/ares_init.c index 35e88a2..2ce344d 100644 --- a/ares_init.c +++ b/ares_init.c @@ -1050,10 +1050,13 @@ static int init_by_defaults(ares_channel channel) channel->nservers = 1; } -#ifdef ENAMETOOLONG -#define toolong(x) (x == -1) && ((ENAMETOOLONG == errno) || (EINVAL == errno)) +#if defined(USE_WINSOCK) +#define toolong(x) (x == -1) && (SOCKERRNO == WSAEFAULT) +#elif defined(ENAMETOOLONG) +#define toolong(x) (x == -1) && ((SOCKERRNO == ENAMETOOLONG) || \ + (SOCKERRNO == EINVAL)) #else -#define toolong(x) (x == -1) && (EINVAL == errno) +#define toolong(x) (x == -1) && (SOCKERRNO == EINVAL) #endif if (channel->ndomains == -1) { |