about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--inet/getnameinfo.c12
2 files changed, 6 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index bb2ca73554..8963152166 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2016-04-28  Florian Weimer  <fweimer@redhat.com>
 
+	* inet/getnameinfo.c (getnameinfo): Do not preserve errno.
+
+2016-04-28  Florian Weimer  <fweimer@redhat.com>
+
 	* resolv/inet_addr.c: Reindent preprocessor conditionals.
 	* resolv/res_init.c: Likewise.
 	* resolv/res_mkquery.c: Likewise.
diff --git a/inet/getnameinfo.c b/inet/getnameinfo.c
index 40f67f082f..9b1847b025 100644
--- a/inet/getnameinfo.c
+++ b/inet/getnameinfo.c
@@ -175,7 +175,6 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
 	     socklen_t hostlen, char *serv, socklen_t servlen,
 	     int flags)
 {
-  int serrno = errno;
   int herrno;
   struct hostent th;
   int ok = 0;
@@ -326,10 +325,7 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
 	if (!ok)
 	  {
 	    if (flags & NI_NAMEREQD)
-	      {
-		__set_errno (serrno);
-		return EAI_NONAME;
-	      }
+	      return EAI_NONAME;
 	    else
 	      {
 		const char *c;
@@ -406,10 +402,7 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
 	  };
 
 	if (flags & NI_NAMEREQD)
-	   {
-	    __set_errno (serrno);
-	    return EAI_NONAME;
-	  }
+	  return EAI_NONAME;
 
 	strncpy (host, "localhost", hostlen);
 	break;
@@ -463,7 +456,6 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
     host[hostlen-1] = 0;
   if (serv && (servlen > 0))
     serv[servlen-1] = 0;
-  errno = serrno;
   return 0;
 }
 libc_hidden_def (getnameinfo)