From bf9d9ceaa3295847d901821c62f5f6f23db7aefd Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Mon, 28 Jul 2014 00:07:37 -0400 Subject: 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. corresponds to commit fe82bb9b921be34370e6b71a1c6f062c20999ae0 in master branch. --- src/network/gethostbyname2_r.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/network/gethostbyname2_r.c') diff --git a/src/network/gethostbyname2_r.c b/src/network/gethostbyname2_r.c index 27eb080f..d6920b26 100644 --- a/src/network/gethostbyname2_r.c +++ b/src/network/gethostbyname2_r.c @@ -20,6 +20,8 @@ int gethostbyname2_r(const char *name, int af, size_t need; const char *canon; + *res = 0; + af = hint.ai_family; /* Align buffer */ -- cgit v1.2.1