summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2015-09-25 01:01:11 +0000
committerRich Felker <dalias@aerifal.cx>2015-09-25 01:03:36 +0000
commit06bcf9bc941a2f3bf34ac4468644d9693802495b (patch)
tree9b01f6cbffb7673a7140d8f763e7b86dcd4fc802
parentb4d94ba40dda0fa0c3f499beed51b55ad31d5305 (diff)
downloadmusl-06bcf9bc941a2f3bf34ac4468644d9693802495b.tar.gz
musl-06bcf9bc941a2f3bf34ac4468644d9693802495b.tar.bz2
musl-06bcf9bc941a2f3bf34ac4468644d9693802495b.tar.xz
musl-06bcf9bc941a2f3bf34ac4468644d9693802495b.zip
make getaddrinfo return error if both host and service name are null
this case is specified as a mandatory ("shall fail") error. based on patch by Julien Ramseier.
-rw-r--r--src/network/getaddrinfo.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/network/getaddrinfo.c b/src/network/getaddrinfo.c
index c88d558c..b9439f77 100644
--- a/src/network/getaddrinfo.c
+++ b/src/network/getaddrinfo.c
@@ -20,6 +20,8 @@ int getaddrinfo(const char *restrict host, const char *restrict serv, const stru
} sa;
} *out;
+ if (!host && !serv) return EAI_NONAME;
+
if (hint) {
family = hint->ai_family;
flags = hint->ai_flags;