[hurd,commited,7/7] hurd: fix warning

Message ID 20180127225102.11373-8-samuel.thibault@ens-lyon.org
State New
Headers show
Series
  • fix warnings
Related show

Commit Message

Samuel Thibault Jan. 27, 2018, 10:51 p.m.
* 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(-)

-- 
2.15.1

Patch

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  <jrtc27@jrtc27.com>
 
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)