From 387250cd83d818e8cf1a48cdbd3475dadcfc92c0 Mon Sep 17 00:00:00 2001 From: Jose Pedro Oliveira Date: Thu, 19 Sep 2013 15:25:22 +0100 Subject: [PATCH 1/6] Fixes compiler warning: implicit declaration of function 'isalnum' --- mnexec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mnexec.c b/mnexec.c index a563499..3171bab 100644 --- a/mnexec.c +++ b/mnexec.c @@ -22,6 +22,7 @@ #include #include #include +#include #if !defined(VERSION) #define VERSION "(devel)" From b8fd3d2d8e479604b0f1bfd932331e203d853472 Mon Sep 17 00:00:00 2001 From: Jose Pedro Oliveira Date: Thu, 19 Sep 2013 15:26:26 +0100 Subject: [PATCH 2/6] Fixes compiler warning: control reaches end of non-void function --- mnexec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mnexec.c b/mnexec.c index 3171bab..3d24743 100644 --- a/mnexec.c +++ b/mnexec.c @@ -177,4 +177,6 @@ int main(int argc, char *argv[]) } usage(argv[0]); + + return 0; } From f5737aa3cc72713a4b3028a12a6be67d051917bb Mon Sep 17 00:00:00 2001 From: Jose Pedro Oliveira Date: Sat, 28 Sep 2013 01:34:01 +0100 Subject: [PATCH 3/6] The header file limits.h was being included twice --- mnexec.c | 1 - 1 file changed, 1 deletion(-) diff --git a/mnexec.c b/mnexec.c index 3d24743..c30b4a6 100644 --- a/mnexec.c +++ b/mnexec.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #include From 8842e450dba6fb874502f4632b4ea1f893e89da0 Mon Sep 17 00:00:00 2001 From: Jose Pedro Oliveira Date: Sat, 28 Sep 2013 01:36:02 +0100 Subject: [PATCH 4/6] Turns on gcc warnings (CFLAGS += -Wall -Wextra) --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index c989e61..74da5ac 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,8 @@ MANDIR = /usr/share/man/man1 DOCDIRS = doc/html doc/latex PDF = doc/latex/refman.pdf +CFLAGS += -Wall -Wextra + all: codecheck test clean: From 2941bbae2d023518edaf8eab443c2bbcec755d56 Mon Sep 17 00:00:00 2001 From: Jose Pedro Oliveira Date: Sat, 28 Sep 2013 01:37:51 +0100 Subject: [PATCH 5/6] Defines _GNU_SOURCE (required by the unshare syscall) --- mnexec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mnexec.c b/mnexec.c index c30b4a6..ea8fb6f 100644 --- a/mnexec.c +++ b/mnexec.c @@ -13,6 +13,7 @@ * Partially based on public domain setsid(1) */ +#define _GNU_SOURCE #include #include #include From 8f80f875b5713bd0077251676c4813b4cf68d51d Mon Sep 17 00:00:00 2001 From: Jose Pedro Oliveira Date: Sat, 28 Sep 2013 01:42:05 +0100 Subject: [PATCH 6/6] Change cgroup() return type from int to void (avoids a gcc warning) --- mnexec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mnexec.c b/mnexec.c index ea8fb6f..b7be9bc 100644 --- a/mnexec.c +++ b/mnexec.c @@ -63,7 +63,7 @@ void validate(char *path) } /* Add our pid to cgroup */ -int cgroup(char *gname) +void cgroup(char *gname) { static char path[PATH_MAX]; static char *groups[] = {