Browse Source

gethostbyname_r: set correct h_errno upon failure

previously gethostbyname_r(ipv6.google.com);herror("ERROR:") gave
Answer name = |ipv6.google.com|
Answer type = |5|
herrno=1
h_errno=0
ERROR:: Error 0

herrno=1
h_errno=1
ERROR:: Unknown host

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Bernhard Reutner-Fischer 12 years ago
parent
commit
40f8f5f033
1 changed files with 1 additions and 0 deletions
  1. 1 0
      libc/inet/resolv.c

+ 1 - 0
libc/inet/resolv.c

@@ -2170,6 +2170,7 @@ int gethostbyname_r(const char *name,
 	}
 
 	*h_errnop = HOST_NOT_FOUND;
+	__set_h_errno(HOST_NOT_FOUND);
 	i = TRY_AGAIN;
 
  free_and_ret: