From patchwork Tue Mar 8 14:27:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 594236 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id BF7DF140BCD for ; Wed, 9 Mar 2016 01:28:14 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=EaK/cQbN; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:message-id:date:mime-version :content-type; q=dns; s=default; b=AzXfxNYgqFpm72Dr5EcVagY68Gtxk jy103J9WpGqL+4ZrsGHmHd9nnt3tsIlc0xcUnZ1zZv1lBUJKmqZkI4xVl6HhXoWV fDPaqzcrvSOAh/kdJu4FE0TAl3TjJuB72VPz0yhcs7OpC6Y4HdrVSDImCG9+6Vfj rZ0gLkR2bkutmE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:message-id:date:mime-version :content-type; s=default; bh=RQhm3WsFp2bra/QyQgjtnIK9GGE=; b=EaK /cQbN74x1rMAIPHZFWHi4Z2A8bctqDM/C2CqvXnUqoSsvmpqIm9AeYw/o2E7vgIG c6sU0MWmDKfrzCje2JFucSs2mllxCSreahn3idjqbbeOXWQLubiX0zIGIT5qJQCc x0ZkoJX50qfIXmPnF4gaCi6sI4qiDHUW9TDNLWk4= Received: (qmail 67504 invoked by alias); 8 Mar 2016 14:28:06 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 67462 invoked by uid 89); 8 Mar 2016 14:28:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=!ok, sk:2a7abbc, preserve X-HELO: mx1.redhat.com To: GNU C Library From: Florian Weimer Subject: [PATCH] getnameinfo: Do not restore errno on error Message-ID: <56DEE16A.5010305@redhat.com> Date: Tue, 8 Mar 2016 15:27:54 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 POSIX does not require it, and this behavior is not documented in the manual page, either. Florian From 3816c2f4c8fee95fc6a18e432c1a22702fb08e3d Mon Sep 17 00:00:00 2001 Message-Id: <3816c2f4c8fee95fc6a18e432c1a22702fb08e3d.1457447223.git.fweimer@redhat.com> From: Florian Weimer Date: Tue, 8 Mar 2016 15:15:10 +0100 Subject: [PATCH] getnameinfo: Do not restore errno on error To: libc-alpha@sourceware.org POSIX does not require it, and this behavior is not documented in the manual page, either. --- ChangeLog | 5 +++++ inet/getnameinfo.c | 12 ++---------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2a7abbc..a3b4324 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2016-03-08 Florian Weimer + * inet/getnameinfo.c (getnameinfo): Do not preserve errno on + error. + +2016-03-08 Florian Weimer + * sunrpc/key_call.c (key_call_keyenvoy): Use int status instead of union wait. Report any non-zero exit status as error. diff --git a/inet/getnameinfo.c b/inet/getnameinfo.c index 40f67f0..9b1847b 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) -- 2.4.3