[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] 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 <ian.jackson@xxxxxxxxxxxxx>

diff -r 8922a1469284 tools/examples/network-bridge
--- a/tools/examples/network-bridge     Wed Jan 09 22:21:58 2008 +0000
+++ b/tools/examples/network-bridge     Thu Jan 10 15:13:15 2008 +0000
@@ -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
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.