about summary refs log tree commit diff
path: root/src/network/gethostbyname2_r.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2014-06-20 13:53:23 +0300
committerRich Felker <dalias@aerifal.cx>2014-06-20 09:17:57 -0400
commitfe82bb9b921be34370e6b71a1c6f062c20999ae0 (patch)
tree1191f70887f39f7617393f3bf27db77575011650 /src/network/gethostbyname2_r.c
parent2e5d256984adb6864ece82fb689ddb2b20e10e4d (diff)
downloadmusl-fe82bb9b921be34370e6b71a1c6f062c20999ae0.tar.gz
musl-fe82bb9b921be34370e6b71a1c6f062c20999ae0.tar.xz
musl-fe82bb9b921be34370e6b71a1c6f062c20999ae0.zip
fix gethostby*_r result pointer value on error
according to the documentation in the man pages, the GNU extension
functions gethostbyaddr_r, gethostbyname_r and gethostbyname2_r are
guaranteed to set the result pointer to NULL in case of error or no
result.
Diffstat (limited to 'src/network/gethostbyname2_r.c')
-rw-r--r--src/network/gethostbyname2_r.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/network/gethostbyname2_r.c b/src/network/gethostbyname2_r.c
index aa8b0a9e..81f71d21 100644
--- a/src/network/gethostbyname2_r.c
+++ b/src/network/gethostbyname2_r.c
@@ -17,6 +17,7 @@ int gethostbyname2_r(const char *name, int af,
 	int i, cnt;
 	size_t align, need;
 
+	*res = 0;
 	cnt = __lookup_name(addrs, canon, name, af, AI_CANONNAME);
 	if (cnt<0) switch (cnt) {
 	case EAI_NONAME: