ovsdb-client: Avoid assertion with multiple databases.
authorJustin Pettit <jpettit@nicira.com>
Mon, 6 May 2013 19:43:48 +0000 (12:43 -0700)
committerJustin Pettit <jpettit@nicira.com>
Tue, 7 May 2013 00:47:34 +0000 (17:47 -0700)
When using ovsdb-client with an ovsdb-server with multiple databases, an
assertion could trigger due to them being returned in non-sorted order.
This commit changes the fetch_dbs() function to always return databases
in sorted order, since both callers are expecting that behavior.

Bug #16882

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Reported-by: Spiro Kourtessis <spiro@vmware.com>
AUTHORS
ovsdb/ovsdb-client.c

diff --git a/AUTHORS b/AUTHORS
index 165fd5a..dd3a240 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -167,6 +167,7 @@ Scott Hendricks         shendricks@nicira.com
 Sean Brady              sbrady@gtfservices.com
 Sebastian Andrzej Siewior  sebastian@breakpoint.cc
 Sébastien RICCIO        sr@swisscenter.com
+Spiro Kourtessis        spiro@vmware.com
 Srini Seetharaman       seethara@stanford.edu
 Stephen Hemminger       shemminger@vyatta.com
 Takayuki HAMA           t-hama@cb.jp.nec.com
index d5d2189..8dcff6b 100644 (file)
@@ -393,6 +393,7 @@ fetch_dbs(struct jsonrpc *rpc, struct svec *dbs)
         svec_add(dbs, name->u.string);
     }
     jsonrpc_msg_destroy(reply);
+    svec_sort(&dbs);
 }
 \f
 static void
@@ -405,7 +406,6 @@ do_list_dbs(struct jsonrpc *rpc, const char *database OVS_UNUSED,
 
     svec_init(&dbs);
     fetch_dbs(rpc, &dbs);
-    svec_sort(&dbs);
     SVEC_FOR_EACH (i, db_name, &dbs) {
         puts(db_name);
     }