diff options
author | Samuel Tan <samueltan@google.com> | 2015-10-05 16:45:48 -0700 |
---|---|---|
committer | Samuel Tan <samueltan@google.com> | 2015-10-05 16:55:13 -0700 |
commit | f260beffc450a98a45c7538b9c5baeaa03d164f4 (patch) | |
tree | b856ef3e2d58fdc3977e23a48b3fe5b2075dbd29 | |
parent | 08946cc5dff65d4103268752f8fb2655119a826a (diff) | |
download | minijail-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-x | gen_constants.sh | 10 |
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 | \ |