1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-26 13:21:07 +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:
Joseph Myers
2014-11-26 20:54:16 +00:00
parent f1a5a0e3c3
commit 8915eacef8
3 changed files with 15 additions and 5 deletions

View File

@ -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 */