From patchwork Sat Jan 27 22:51:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 866793 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-89717-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="rsE9ULbp"; dkim-atps=neutral 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 3zTWSK6bnYz9sRm for ; Sun, 28 Jan 2018 09:59:45 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=yYr47uGvDq3LIsDskfqPleRVxo3ag2V kGHd4rUbNsOgnY5HTeMuHmjVj7W5LFOs4l8iYGPoPVJUGtxASJQJsajG27ZFt0/L PVD46RpQKVFKIslmqT10trzAIVrdNgYJ4IP6D55WiuJuGqDX3nhP4pYbHKOW2YuI 8Kurw0k0H3Pk= 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:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=LyfE+JGVTdCO17/lIrbUD8lC4EU=; b=rsE9U LbpwddyMpwLts08pbQ6AB1JSXTXWR/2CCQJ4oP0sBG830VrxjwmA/Y7Q+wIgqVIP YoKariv4BytAx20yrgSsp75r4gA38QF4t5O3wuUy8Kqs6vChedlugd/r3BkWzEcn ddfFJ49EPZAlviYnNzEcx/B92Efyocg+1j0vb4= Received: (qmail 14378 invoked by alias); 27 Jan 2018 22:59:32 -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 14344 invoked by uid 89); 27 Jan 2018 22:59:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, SPF_NEUTRAL autolearn=ham version=3.3.2 spammy=UD:lock X-HELO: hera.aquilenet.fr From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault Subject: [hurd,commited 7/7] hurd: fix warning Date: Sat, 27 Jan 2018 23:51:02 +0100 Message-Id: <20180127225102.11373-8-samuel.thibault@ens-lyon.org> In-Reply-To: <20180127225102.11373-1-samuel.thibault@ens-lyon.org> References: <20180127225102.11373-1-samuel.thibault@ens-lyon.org> * sysdeps/mach/hurd/getresgid.c (__getresgid): Set result from critical section to make code simpler and avoid warning. * sysdeps/mach/hurd/getresuid.c (__getresuid): Set result from critical section to make code simpler and avoid warning. --- ChangeLog | 4 ++++ sysdeps/mach/hurd/getresgid.c | 17 ++++++----------- sysdeps/mach/hurd/getresuid.c | 17 ++++++----------- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 95e2c07df5..5eebc649cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -33,6 +33,10 @@ to global scope. * sysdeps/mach/pagecopy.h (PAGE_THRESHOLD): Rename to PAGE_COPY_THRESHOLD and set to benchmarked 16384. + * sysdeps/mach/hurd/getresgid.c (__getresgid): Set result from + critical section to make code simpler and avoid warning. + * sysdeps/mach/hurd/getresuid.c (__getresuid): Set result from + critical section to make code simpler and avoid warning. 2018-01-27 James Clarke diff --git a/sysdeps/mach/hurd/getresgid.c b/sysdeps/mach/hurd/getresgid.c index 41823ff3e1..e5eeba8ac5 100644 --- a/sysdeps/mach/hurd/getresgid.c +++ b/sysdeps/mach/hurd/getresgid.c @@ -27,7 +27,6 @@ int __getresgid (gid_t *rgid, gid_t *egid, gid_t *sgid) { error_t err; - gid_t real, eff, saved; HURD_CRITICAL_BEGIN; __mutex_lock (&_hurd_id.lock); @@ -40,22 +39,18 @@ __getresgid (gid_t *rgid, gid_t *egid, gid_t *sgid) err = EGRATUITOUS; else { - real = _hurd_id.aux.gids[0]; - eff = _hurd_id.gen.ngids < 1 ? real : _hurd_id.gen.gids[0]; - saved = _hurd_id.aux.ngids < 2 ? real : _hurd_id.aux.gids[1]; + gid_t real = _hurd_id.aux.gids[0]; + + *rgid = real; + *egid = _hurd_id.gen.ngids < 1 ? real : _hurd_id.gen.gids[0]; + *sgid = _hurd_id.aux.ngids < 2 ? real : _hurd_id.aux.gids[1]; } } __mutex_unlock (&_hurd_id.lock); HURD_CRITICAL_END; - if (err) - return __hurd_fail (err); - - *rgid = real; - *egid = eff; - *sgid = saved; - return 0; + return __hurd_fail (err); } libc_hidden_def (__getresgid) weak_alias (__getresgid, getresgid) diff --git a/sysdeps/mach/hurd/getresuid.c b/sysdeps/mach/hurd/getresuid.c index 1f2340350b..4af4786fc5 100644 --- a/sysdeps/mach/hurd/getresuid.c +++ b/sysdeps/mach/hurd/getresuid.c @@ -27,7 +27,6 @@ int __getresuid (uid_t *ruid, uid_t *euid, uid_t *suid) { error_t err; - uid_t real, eff, saved; HURD_CRITICAL_BEGIN; __mutex_lock (&_hurd_id.lock); @@ -40,22 +39,18 @@ __getresuid (uid_t *ruid, uid_t *euid, uid_t *suid) err = EGRATUITOUS; else { - real = _hurd_id.aux.uids[0]; - eff = _hurd_id.gen.nuids < 1 ? real : _hurd_id.gen.uids[0]; - saved = _hurd_id.aux.nuids < 2 ? real : _hurd_id.aux.uids[1]; + uid_t real = _hurd_id.aux.uids[0]; + + *ruid = real; + *euid = _hurd_id.gen.nuids < 1 ? real : _hurd_id.gen.uids[0]; + *suid = _hurd_id.aux.nuids < 2 ? real : _hurd_id.aux.uids[1]; } } __mutex_unlock (&_hurd_id.lock); HURD_CRITICAL_END; - if (err) - return __hurd_fail (err); - - *ruid = real; - *euid = eff; - *suid = saved; - return 0; + return __hurd_fail (err); } libc_hidden_def (__getresuid) weak_alias (__getresuid, getresuid)