Fix get_if_var() with 3 args (i.e. with default)

All xxx_<ifname> flags are set to empty strings automatically earlier so
eval echo \${${prefix}${_if}${suffix}-${_default}}
not substitute the default but return just the empty string.
Fix it using
eval echo \${${prefix}${_if}${suffix}:-${_default}}
(i.e. treat empty strings as unset)

The bug manifistates itself with the following warning from checkyesno():
/etc/rc.d/dhclient: WARNING: $background_dhclient is not set properly -
see rc.conf(5)
This commit is contained in:
Andrey A. Chernov 2007-03-29 10:55:33 +00:00
parent 8f91a6f900
commit 2395c8cbfc

View File

@ -118,7 +118,7 @@ get_if_var()
prefix=${_var%%IF*}
suffix=${_var##*IF}
eval echo \${${prefix}${_if}${suffix}-${_default}}
eval echo \${${prefix}${_if}${suffix}:-${_default}}
}
# _ifconfig_getargs if