wg-quick: make darwin and freebsd path search strict like linux
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
090639ae90
commit
c2355e00aa
|
@ -47,7 +47,8 @@ parse_options() {
|
||||||
CONFIG_FILE="$1"
|
CONFIG_FILE="$1"
|
||||||
if [[ $CONFIG_FILE =~ ^[a-zA-Z0-9_=+.-]{1,15}$ ]]; then
|
if [[ $CONFIG_FILE =~ ^[a-zA-Z0-9_=+.-]{1,15}$ ]]; then
|
||||||
for path in "${CONFIG_SEARCH_PATHS[@]}"; do
|
for path in "${CONFIG_SEARCH_PATHS[@]}"; do
|
||||||
[[ -e $path/$CONFIG_FILE.conf ]] && { CONFIG_FILE="$path/$CONFIG_FILE.conf"; break; }
|
CONFIG_FILE="$path/$1.conf"
|
||||||
|
[[ -e $CONFIG_FILE ]] && break
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
[[ -e $CONFIG_FILE ]] || die "\`$CONFIG_FILE' does not exist"
|
[[ -e $CONFIG_FILE ]] || die "\`$CONFIG_FILE' does not exist"
|
||||||
|
|
|
@ -64,7 +64,8 @@ parse_options() {
|
||||||
CONFIG_FILE="$1"
|
CONFIG_FILE="$1"
|
||||||
if [[ $CONFIG_FILE =~ ^[a-zA-Z0-9_=+.-]{1,15}$ ]]; then
|
if [[ $CONFIG_FILE =~ ^[a-zA-Z0-9_=+.-]{1,15}$ ]]; then
|
||||||
for path in "${CONFIG_SEARCH_PATHS[@]}"; do
|
for path in "${CONFIG_SEARCH_PATHS[@]}"; do
|
||||||
[[ -e $path/$CONFIG_FILE.conf ]] && { CONFIG_FILE="$path/$CONFIG_FILE.conf"; break; }
|
CONFIG_FILE="$path/$1.conf"
|
||||||
|
[[ -e $CONFIG_FILE ]] && break
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
[[ -e $CONFIG_FILE ]] || die "\`$CONFIG_FILE' does not exist"
|
[[ -e $CONFIG_FILE ]] || die "\`$CONFIG_FILE' does not exist"
|
||||||
|
|
Reference in New Issue