From cae7be1a60cd1642ecdbba16f059d976827612b4 Mon Sep 17 00:00:00 2001 From: Zi Shen Lim Date: Wed, 18 Sep 2013 10:32:45 -0700 Subject: [PATCH] mnexec: getopt bugfix getopt returns an 'int', so use change datatype of 'c' to match it. Otherwise, 'c' may hold a value of 255 (0xff), and fail the comparison with -1 (0xffffffff): while ((c = getopt(...)) != -1) This bug was uncovered on Ubuntu 13.04 running on ARM, using arm-linux-gnueabihf-gcc4.7. --- mnexec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mnexec.c b/mnexec.c index b1b2745..a563499 100644 --- a/mnexec.c +++ b/mnexec.c @@ -92,7 +92,7 @@ int cgroup(char *gname) int main(int argc, char *argv[]) { - char c; + int c; int fd; char path[PATH_MAX]; int nsid;