Skip to content

Commit

Permalink
jsonrpc: Don't assert for 0 remotes in jsonrpc_session_open_multiple().
Browse files Browse the repository at this point in the history
It's pretty easy to get 0 remotes here from ovn-northd if you specify
--ovnnb-db='' or --ovnnb-db='   ' on the command line.  The internals
of jsonrpc_session aren't equipped to cope with that, so just add a
dummy remote instead.

Acked-by: Numan Siddique <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
blp committed Jun 29, 2020
1 parent 7d68168 commit f740828
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/jsonrpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -825,8 +825,10 @@ jsonrpc_session_open_multiple(const struct svec *remotes, bool retry)
s = xmalloc(sizeof *s);

/* Set 'n' remotes from 'names'. */
ovs_assert(remotes->n > 0);
svec_clone(&s->remotes, remotes);
if (!s->remotes.n) {
svec_add(&s->remotes, "invalid:");
}
s->next_remote = 0;

s->reconnect = reconnect_create(time_msec());
Expand Down

0 comments on commit f740828

Please sign in to comment.