network-bridge shell quoting
PATCH 1/1 network-bridge shell quoting
In tools/examples/network-bridge, the attached patch should be applied.
In the old code, if addr_pfx (for example) is unset or empty, the if test involves executing
[ ]
which produces an error message before exiting nonzero ie false. The attached changes suppresses this spurious error message by properly quoting addr_pfx, and adding `-n' to make the argument unparsing for [ more robust.
This was inspired by, but not derived from (insofar as one 2-line fix to the same bug can be derived from another), an identically named patch in the CentOS 5.1 SRPM.
Ian.
Signed-off-by Ian Jackson <[email protected]>
tools/examples/network-bridge +2 -2
@@ -96,12 +96,12 @@ get_ip_info() { do_ifup() { if ! ifup $1 ; then - if [ ${addr_pfx} ] ; then + if [ -n "$addr_pfx" ] ; then # use the info from get_ip_info() ip addr flush $1 ip addr add ${addr_pfx} dev $1 ip link set dev $1 up - [ ${gateway} ] && ip route add default via ${gateway} + [ -n "$gateway" ] && ip route add default via ${gateway} fi fi }
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel