From 7d68839e9ea89b0a92aef69a9b4fd298554bb9b1 Mon Sep 17 00:00:00 2001 From: Mike Gilbert Date: Sat, 12 Mar 2016 13:01:51 -0500 Subject: [PATCH] tmpfiles: Make unrecognized options fatal This is part of #83. --- sh/tmpfiles.sh.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in index 43442d79..f711b1da 100644 --- a/sh/tmpfiles.sh.in +++ b/sh/tmpfiles.sh.in @@ -33,6 +33,11 @@ warninvalid() { error=$(( error+1 )) } >&2 +invalid_option() { + printf "tmpfiles: invalid option '%s'\n" "$1" >&2 + exit 1 +} + dryrun_or_real() { local dryrun= [ $DRYRUN -eq 1 ] && dryrun=echo @@ -299,6 +304,7 @@ while [ $# -gt 0 ]; do --dryrun|--dry-run) DRYRUN=1 ;; --exclude-prefix=*) EXCLUDE="${EXCLUDE}${1##--exclude-prefix=} " ;; --prefix=*) PREFIX="${PREFIX}${1##--prefix=} " ;; + -*) invalid_option "$1" ;; esac shift done