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

[Xen-API] [PATCH] CA-37028: Netdev.vswitch: correct vsctl handling of empty response



The callers expect that if vsctl returns no output an empty list will
be returned. Instead a list containing the empty string was returned
due to the behaviour of Stringext.Strings.split when passed an empty
string. Explicitly check for an empty response from vsctl.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r b180a565573e -r 18f593937240 ocaml/netdev/netdev.ml
--- a/ocaml/netdev/netdev.ml    Mon Jan 25 10:30:12 2010 +0000
+++ b/ocaml/netdev/netdev.ml    Mon Jan 25 13:36:25 2010 +0000
@@ -219,7 +219,9 @@
   Unix.access vsctl_script [ Unix.X_OK ];
   let output, _ = Forkhelpers.execute_command_get_output vsctl_script args in
   let stripped = Stringext.String.strip (fun c -> c='\n') output in
-  Stringext.String.split '\n' stripped
+  match stripped with
+    | "" -> []
+    | s -> Stringext.String.split '\n' s
 
 let add name = ignore(vsctl ["add-br" ; name])
 let del name = ignore(vsctl ["del-br" ; name])

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api


 


Rackspace

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