Make it possible to compile with clang
authorRobert Swiecki <swiecki@google.com>
Mon, 29 Feb 2016 18:09:39 +0000 (19:09 +0100)
committerRobert Swiecki <swiecki@google.com>
Mon, 29 Feb 2016 18:09:39 +0000 (19:09 +0100)
Makefile
contain.c

index b9c8e84c2fe97d9c4ac47e09819988e4d2407243..3611b3d823e69981d28438647e4ae7be5366ca8f 100644 (file)
--- a/Makefile
+++ b/Makefile
 #   limitations under the License.
 #
 
-CC = gcc
+CC ?= gcc
 CFLAGS += -O2 -g -ggdb -c -std=c11 \
        -D_GNU_SOURCE \
        -fstack-protector-all -Wformat -Wformat=2 -Wformat-security -fPIE -Wa,--noexecstack \
        -Wall -Wextra -Werror
 
-LD = gcc
 LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie
 
 SRCS = nsjail.c cmdline.c contain.c log.c net.c subproc.c sandbox.c util.c seccomp/bpf-helper.c
@@ -36,7 +35,7 @@ BIN = nsjail
 all: $(BIN)
 
 $(BIN): $(OBJS)
-       $(LD) -o $(BIN) $(OBJS) $(LDFLAGS)
+       $(CC) -o $(BIN) $(OBJS) $(LDFLAGS)
 
 clean:
        $(RM) core Makefile.bak $(OBJS) $(BIN)
index 5d64e96f8add520cb86622db54c8797ebaa966d5..c1036030b4849e568c92dcdc219a21966ed21e8f 100644 (file)
--- a/contain.c
+++ b/contain.c
@@ -156,7 +156,7 @@ bool containDropPrivs(struct nsjconf_t * nsjconf)
                        .version = _LINUX_CAPABILITY_VERSION_3,
                        .pid = 0,
                };
-               const struct __user_cap_data_struct const cap_data[_LINUX_CAPABILITY_U32S_3] = {
+               const struct __user_cap_data_struct cap_data[_LINUX_CAPABILITY_U32S_3] = {
                        [0 ... (_LINUX_CAPABILITY_U32S_3 - 1)].inheritable = 0U,
                        [0 ... (_LINUX_CAPABILITY_U32S_3 - 1)].effective = 0U,
                        [0 ... (_LINUX_CAPABILITY_U32S_3 - 1)].permitted = 0U,