diff --git a/Makefile b/Makefile index 9236c64..7d9acb8 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,8 @@ CFLAGS += -O2 -g -ggdb -c -std=gnu11 \ LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie -Wa,--noexecstack -COMPILER_CLANG = $(shell $(CC) -v 2>&1 | grep version | head -n1 | egrep -o clang) +COMPILER_CLANG = $(shell $(CC) -v 2>&1 | grep "clang version" | grep -o "clang") + ifeq ($(COMPILER_CLANG),clang) CFLAGS += -fblocks LDFLAGS += -lBlocksRuntime diff --git a/nsjail.c b/nsjail.c index 6dbfc0c..5f125b6 100644 --- a/nsjail.c +++ b/nsjail.c @@ -115,6 +115,7 @@ static void nsjailListenMode(struct nsjconf_t *nsjconf) if (listenfd == -1) { return; } + defer(close(listenfd)); for (;;) { if (nsjailSigFatal > 0) { subprocKillAll(nsjconf);