This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.20-265-g8915eac


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  8915eacef88eb25ac94e6bb37b473adb326e9d1b (commit)
      from  f1a5a0e3c3d32bb800a0a63a0cfcd1b25a8e3d4d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=8915eacef88eb25ac94e6bb37b473adb326e9d1b

commit 8915eacef88eb25ac94e6bb37b473adb326e9d1b
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Wed Nov 26 20:54:16 2014 +0000

    Avoid warnings for unused results in nscd/connections.c.
    
    This patch avoids warnings for unused results of setuid and setgid in
    nscd/connections.c using an ignore_value macro along the lines
    suggested by Paul in
    <https://sourceware.org/ml/libc-alpha/2014-11/msg00733.html>.
    
    Tested for x86_64.
    
    	* include/libc-internal.h (ignore_value): New macro.
    	* nscd/connections.c (restart): Wrap calls to setuid and setgid
    	with ignore_value.

diff --git a/ChangeLog b/ChangeLog
index 5ec7f0d..44c9453 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2014-11-26  Joseph Myers  <joseph@codesourcery.com>
 
+	* include/libc-internal.h (ignore_value): New macro.
+	* nscd/connections.c (restart): Wrap calls to setuid and setgid
+	with ignore_value.
+
 	* sysdeps/mips/__longjmp.c (____longjmp): Use prototype
 	definition.
 
diff --git a/include/libc-internal.h b/include/libc-internal.h
index 78f82da..2ced1c1 100644
--- a/include/libc-internal.h
+++ b/include/libc-internal.h
@@ -70,4 +70,10 @@ extern void __init_misc (int, char **, char **);
 #define PTR_ALIGN_UP(base, size) \
   ((__typeof__ (base)) ALIGN_UP ((uintptr_t) (base), (size)))
 
+/* Ignore the value of an expression when a cast to void does not
+   suffice (in particular, for a call to a function declared with
+   attribute warn_unused_result).  */
+#define ignore_value(x) \
+  ({ __typeof__ (x) __ignored_value = (x); (void) __ignored_value; })
+
 #endif /* _LIBC_INTERNAL  */
diff --git a/nscd/connections.c b/nscd/connections.c
index 3e950af..1631212 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -1464,7 +1464,7 @@ cannot change to old UID: %s; disabling paranoia mode"),
 cannot change to old GID: %s; disabling paranoia mode"),
 		   strerror (errno));
 
-	  setuid (server_uid);
+	  ignore_value (setuid (server_uid));
 	  paranoia = 0;
 	  return;
 	}
@@ -1479,8 +1479,8 @@ cannot change to old working directory: %s; disabling paranoia mode"),
 
       if (server_user != NULL)
 	{
-	  setuid (server_uid);
-	  setgid (server_gid);
+	  ignore_value (setuid (server_uid));
+	  ignore_value (setgid (server_gid));
 	}
       paranoia = 0;
       return;
@@ -1524,8 +1524,8 @@ cannot change to old working directory: %s; disabling paranoia mode"),
 
   if (server_user != NULL)
     {
-      setuid (server_uid);
-      setgid (server_gid);
+      ignore_value (setuid (server_uid));
+      ignore_value (setgid (server_gid));
     }
   if (chdir ("/") != 0)
     dbg_log (_("cannot change current working directory to \"/\": %s"),

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog               |    4 ++++
 include/libc-internal.h |    6 ++++++
 nscd/connections.c      |   10 +++++-----
 3 files changed, 15 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]