diff options
author | 2012-07-13 14:05:12 +0000 | |
---|---|---|
committer | 2012-07-13 14:05:12 +0000 | |
commit | 8b2098d58618e84c16dd0c5483044e371d2e4586 (patch) | |
tree | 5c2c10bbea4a12ab6a5fdd1c5c8b390ebbbf3d55 /lib/libc | |
parent | tidbit (diff) | |
download | wireguard-openbsd-8b2098d58618e84c16dd0c5483044e371d2e4586.tar.xz wireguard-openbsd-8b2098d58618e84c16dd0c5483044e371d2e4586.zip |
properly report EAI_SERVICE when the given servname is not defined for
the given protocol.
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/asr/getaddrinfo_async.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/asr/getaddrinfo_async.c b/lib/libc/asr/getaddrinfo_async.c index 797fb053aac..2919c970743 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.3 2012/07/10 09:20:51 eric Exp $ */ +/* $OpenBSD: getaddrinfo_async.c,v 1.4 2012/07/13 14:05:12 eric Exp $ */ /* * Copyright (c) 2012 Eric Faurot <eric@openbsd.org> * @@ -191,7 +191,9 @@ getaddrinfo_async_run(struct async *as, struct async_res *ar) as->as.ai.port_tcp = get_port(as->as.ai.servname, "tcp", as->as.ai.hints.ai_flags & AI_NUMERICSERV); if (as->as.ai.port_tcp == -2 || as->as.ai.port_udp == -2 || - (as->as.ai.port_tcp == -1 && as->as.ai.port_udp == -1)) { + (as->as.ai.port_tcp == -1 && as->as.ai.port_udp == -1) || + (ai->ai_protocol && (as->as.ai.port_udp == -1 || + as->as.ai.port_tcp == -1))) { ar->ar_h_errno = NO_RECOVERY; ar->ar_gai_errno = EAI_SERVICE; break; |