From a6ef2ffed4af47ff360bf0fc508aa24e83418f97 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 1 May 2017 17:22:05 -0400 Subject: bugfix [2/2]: librefetch: Correctly fail when given bogus flags --- src/librefetch/librefetch | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/librefetch') diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch index b0b538e..86986f3 100755 --- a/src/librefetch/librefetch +++ b/src/librefetch/librefetch @@ -250,9 +250,10 @@ parse_options() { long2+=() # Feed the options through getopt (sanitize them) - local shrt="$({ printf '%s\0' "${shrt1[@]}"; printf '%s:\0' "${shrt2[@]}"; } | sort -zu | xargs -0 printf '%s')" - local long="$({ printf '%s\0' "${long1[@]}"; printf '%s:\0' "${long2[@]}"; } | sort -zu | xargs -0 printf '%s,')" - local args="$(getopt -n "$cmd" -o "$shrt" -l "${long%,}" -- "$@")" || ret=$? + local shrt long args + shrt="$({ printf '%s\0' "${shrt1[@]}"; printf '%s:\0' "${shrt2[@]}"; } | sort -zu | xargs -0 printf '%s')" + long="$({ printf '%s\0' "${long1[@]}"; printf '%s:\0' "${long2[@]}"; } | sort -zu | xargs -0 printf '%s,')" + args="$(getopt -n "$cmd" -o "$shrt" -l "${long%,}" -- "$@")" || ret=$? eval set -- "$args" unset shrt long args -- cgit v1.2.2