1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-24 11:29:10 +00:00

Fix incorrect return status if var_to_set and var_to_get are the same.

This commit is contained in:
Devin Teske 2014-03-07 20:18:39 +00:00
parent 9680f649c5
commit 2a2674499e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=262898

View File

@ -270,9 +270,9 @@ f_getvar()
{ {
local __var_to_get="$1" __var_to_set="$2" local __var_to_get="$1" __var_to_set="$2"
[ "$__var_to_set" ] || local value [ "$__var_to_set" ] || local value
eval ${__var_to_set:-value}=\"\${$__var_to_get}\"
eval [ \"\${$__var_to_get+set}\" ] eval [ \"\${$__var_to_get+set}\" ]
local __retval=$? local __retval=$?
eval ${__var_to_set:-value}=\"\${$__var_to_get}\"
eval f_dprintf '"f_getvar: var=[%s] value=[%s] r=%u"' \ eval f_dprintf '"f_getvar: var=[%s] value=[%s] r=%u"' \
\"\$__var_to_get\" \"\$${__var_to_set:-value}\" \$__retval \"\$__var_to_get\" \"\$${__var_to_set:-value}\" \$__retval
[ "$__var_to_set" ] || { [ "$value" ] && echo "$value"; } [ "$__var_to_set" ] || { [ "$value" ] && echo "$value"; }