summaryrefslogtreecommitdiff
path: root/lib/libc/asr
diff options
context:
space:
mode:
authorEric Faurot <eric@cvs.openbsd.org>2017-02-21 07:28:29 +0000
committerEric Faurot <eric@cvs.openbsd.org>2017-02-21 07:28:29 +0000
commitaed7e5dd1a9d8636c7eb14d111a4c931fbf288c1 (patch)
tree186f7e15c2c1cce7d0f7f3c164d8b8359d954f15 /lib/libc/asr
parent426234288be8ac97be69e83666371ba8b2af5276 (diff)
Report the errno set by getifaddrs(3) if the setup for AI_ADDRCONFIG fails,
rather than a non-informative EAI_FAIL. Compare to -1 for error detection while here. ok jca@ gilles@
Diffstat (limited to 'lib/libc/asr')
-rw-r--r--lib/libc/asr/getaddrinfo_async.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libc/asr/getaddrinfo_async.c b/lib/libc/asr/getaddrinfo_async.c
index e60d30d3782..71bf4488d97 100644
--- a/lib/libc/asr/getaddrinfo_async.c
+++ b/lib/libc/asr/getaddrinfo_async.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getaddrinfo_async.c,v 1.50 2015/12/16 16:32:30 deraadt Exp $ */
+/* $OpenBSD: getaddrinfo_async.c,v 1.51 2017/02/21 07:28:28 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -191,8 +191,9 @@ getaddrinfo_async_run(struct asr_query *as, struct asr_result *ar)
/* Restrict result set to configured address families */
if (ai->ai_flags & AI_ADDRCONFIG) {
- if (addrconfig_setup(as) != 0) {
- ar->ar_gai_errno = EAI_FAIL;
+ if (addrconfig_setup(as) == -1) {
+ ar->ar_errno = errno;
+ ar->ar_gai_errno = EAI_SYSTEM;
async_set_state(as, ASR_STATE_HALT);
break;
}
@@ -679,7 +680,7 @@ addrconfig_setup(struct asr_query *as)
struct sockaddr_in *sinp;
struct sockaddr_in6 *sin6p;
- if (getifaddrs(&ifa0) != 0)
+ if (getifaddrs(&ifa0) == -1)
return (-1);
as->as.ai.flags |= ASYNC_NO_INET | ASYNC_NO_INET6;