Skip to contentSkip to conversation

selinux-testsuite: fix cap_userns compiler warnings

PATCH New Paul Moore 1 participant 1 message Aug 16, 2016 SELinux security module

lore
Share & tools
lore

Paul Moore

author
#0 lore raw

PATCH 1/1 selinux-testsuite: fix cap_userns compiler warnings

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.

---
 tests/cap_userns/userns_child_exec.c |    4 ++++
 1 file changed, 4 insertions(+)
tests/cap_userns/userns_child_exec.c +4 -0
index 26ea357..e31bf71 100644
@@ -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>