mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-28 00:21:52 +03:00
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.
This commit is contained in:
@ -1,5 +1,9 @@
|
|||||||
2014-11-26 Joseph Myers <joseph@codesourcery.com>
|
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
|
* sysdeps/mips/__longjmp.c (____longjmp): Use prototype
|
||||||
definition.
|
definition.
|
||||||
|
|
||||||
|
@ -70,4 +70,10 @@ extern void __init_misc (int, char **, char **);
|
|||||||
#define PTR_ALIGN_UP(base, size) \
|
#define PTR_ALIGN_UP(base, size) \
|
||||||
((__typeof__ (base)) ALIGN_UP ((uintptr_t) (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 */
|
#endif /* _LIBC_INTERNAL */
|
||||||
|
@ -1464,7 +1464,7 @@ cannot change to old UID: %s; disabling paranoia mode"),
|
|||||||
cannot change to old GID: %s; disabling paranoia mode"),
|
cannot change to old GID: %s; disabling paranoia mode"),
|
||||||
strerror (errno));
|
strerror (errno));
|
||||||
|
|
||||||
setuid (server_uid);
|
ignore_value (setuid (server_uid));
|
||||||
paranoia = 0;
|
paranoia = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1479,8 +1479,8 @@ cannot change to old working directory: %s; disabling paranoia mode"),
|
|||||||
|
|
||||||
if (server_user != NULL)
|
if (server_user != NULL)
|
||||||
{
|
{
|
||||||
setuid (server_uid);
|
ignore_value (setuid (server_uid));
|
||||||
setgid (server_gid);
|
ignore_value (setgid (server_gid));
|
||||||
}
|
}
|
||||||
paranoia = 0;
|
paranoia = 0;
|
||||||
return;
|
return;
|
||||||
@ -1524,8 +1524,8 @@ cannot change to old working directory: %s; disabling paranoia mode"),
|
|||||||
|
|
||||||
if (server_user != NULL)
|
if (server_user != NULL)
|
||||||
{
|
{
|
||||||
setuid (server_uid);
|
ignore_value (setuid (server_uid));
|
||||||
setgid (server_gid);
|
ignore_value (setgid (server_gid));
|
||||||
}
|
}
|
||||||
if (chdir ("/") != 0)
|
if (chdir ("/") != 0)
|
||||||
dbg_log (_("cannot change current working directory to \"/\": %s"),
|
dbg_log (_("cannot change current working directory to \"/\": %s"),
|
||||||
|
Reference in New Issue
Block a user