aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Tan <samueltan@google.com>2015-10-05 16:45:48 -0700
committerSamuel Tan <samueltan@google.com>2015-10-05 16:55:13 -0700
commitf260beffc450a98a45c7538b9c5baeaa03d164f4 (patch)
treeb856ef3e2d58fdc3977e23a48b3fe5b2075dbd29
parent08946cc5dff65d4103268752f8fb2655119a826a (diff)
downloadminijail-f260beffc450a98a45c7538b9c5baeaa03d164f4.tar.gz
minijail: fix input validation in gen_constants.sh
Add missing whitespace to input validation check in gen_constants.sh, so that this check actually runs. While there, reduce the 3-argument version of this script to 2 arguments by combining the path to the compiler binary and the arguments to pass to the compiler into one argument. BUG=chromium:539662 TEST=minijail builds using emerge. Change-Id: Ib31688b034d960b6dbb2cb241401ef560f3c517f
-rwxr-xr-xgen_constants.sh10
1 files changed, 4 insertions, 6 deletions
diff --git a/gen_constants.sh b/gen_constants.sh
index 8dcbca2..0ad29ba 100755
--- a/gen_constants.sh
+++ b/gen_constants.sh
@@ -11,17 +11,15 @@
set -e
-if [ $# -ne 1 ] && [ $# -ne 3]; then
+if [ $# -ne 1 ] && [ $# -ne 2 ]; then
echo "Usage: $(basename "$0") OUTFILE"
- echo "Usage: $(basename "$0") CC CFLAGS OUTFILE"
+ echo "Usage: $(basename "$0") CC OUTFILE"
exit 1
fi
-if [ $# -eq 3 ]; then
+if [ $# -eq 2 ]; then
CC="$1"
shift
- CFLAGS="$1"
- shift
fi
OUTFILE="$1"
@@ -45,7 +43,7 @@ $INCLUDES
#include "libconstants.h"
const struct constant_entry constant_table[] = {
$(echo "$INCLUDES" | \
- ${CC} ${CFLAGS} -dD - -E | \
+ ${CC} -dD - -E | \
grep '^#define [A-Z][A-Z0-9_]* ' | \
grep -v '\(SIGRTMAX\|SIGRTMIN\|SIG_\|NULL\)' | \
sort | \