]> git.ipfire.org Git - thirdparty/wireguard-tools.git/commitdiff
wg-quick: allow config files without trailing newline
authorJason A. Donenfeld <Jason@zx2c4.com>
Wed, 22 Feb 2017 19:23:00 +0000 (20:23 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Thu, 23 Feb 2017 06:09:49 +0000 (07:09 +0100)
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
src/wg-quick.bash

index 275594eafc2e3cd01cb570c197c79c84919a0581..ccf27a9cc4e2564727b89a541d5fd927af7432db 100755 (executable)
@@ -31,7 +31,7 @@ parse_options() {
        ((($(stat -c '%#a' "$CONFIG_FILE") & 0007) == 0)) || echo "Warning: \`$CONFIG_FILE' is world accessible" >&2
        INTERFACE="${BASH_REMATCH[1]}"
        shopt -s nocasematch
-       while read -r line; do
+       while read -r line || [[ -n $line ]]; do
                key="${line%%=*}"; key="${key##*( )}"; key="${key%%*( )}"
                value="${line#*=}"; value="${value##*( )}"; value="${value%%*( )}"
                [[ $key == "["* ]] && interface_section=0