diff mbox

selinux-testsuite: fix cap_userns compiler warnings

Message ID 147137830278.28034.16028483708824878946.stgit@localhost (mailing list archive)
State Accepted
Headers show

Commit Message

Paul Moore Aug. 16, 2016, 8:11 p.m. UTC
The top-level Makefile defines _GNU_SOURCE by default which causes the
following build warning:

    cc -g -O0 -Wall -D_GNU_SOURCE userns_child_exec.c -o userns_child_exec
    userns_child_exec.c:11:0: warning: "_GNU_SOURCE" redefined
     #define _GNU_SOURCE

... this patch first checks to see if _GNU_SOURCE is defined before
defining it again.  We're doing it this way, instead of removing it
entirely so that the test will still work outside the testsuite.

Signed-off-by: Paul Moore <paul@paul-moore.com>
---
 tests/cap_userns/userns_child_exec.c |    4 ++++
 1 file changed, 4 insertions(+)
diff mbox

Patch

diff --git a/tests/cap_userns/userns_child_exec.c b/tests/cap_userns/userns_child_exec.c
index 26ea357..e31bf71 100644
--- a/tests/cap_userns/userns_child_exec.c
+++ b/tests/cap_userns/userns_child_exec.c
@@ -8,7 +8,11 @@ 
    namespace(s); allow UID and GID mappings to be specified when
    creating a user namespace.
 */
+
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE
+#endif
+
 #include <sched.h>
 #include <unistd.h>
 #include <stdlib.h>