about summary refs log tree commit diff
path: root/inet
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2016-04-28 17:41:49 +0200
committerFlorian Weimer <fweimer@redhat.com>2016-04-28 17:41:49 +0200
commit2b54cbce2c363ab6ae89d10657d7465858116d7a (patch)
tree13bcd6be3e47ab2034954f34929e87b6aca761ef /inet
parented3c7876ccf1188b4500e3c3a5f420b700f9e822 (diff)
downloadglibc-2b54cbce2c363ab6ae89d10657d7465858116d7a.tar.gz
glibc-2b54cbce2c363ab6ae89d10657d7465858116d7a.tar.xz
glibc-2b54cbce2c363ab6ae89d10657d7465858116d7a.zip
getnameinfo: Do not preserve errno
POSIX does not require it, the companion getaddrinfo implementation
does not do it, and this behavior is not documented in the manual
page, either.
Diffstat (limited to 'inet')
-rw-r--r--inet/getnameinfo.c12
1 files changed, 2 insertions, 10 deletions
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)