Skip to content

Commit

Permalink
ovs-vsctl: Correctly exit on errors for non-map types in "remove" com…
Browse files Browse the repository at this point in the history
…mand.

Reported-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
  • Loading branch information
blp committed Sep 2, 2014
1 parent 37a8eee commit 89b92e4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions tests/ovs-vsctl.at
Expand Up @@ -838,6 +838,9 @@ AT_CHECK([RUN_OVS_VSCTL([set port br1 name br2])],
AT_CHECK([RUN_OVS_VSCTL([remove bridge br1 name br1])],
[1], [], [ovs-vsctl: cannot modify read-only column name in table Bridge
], [OVS_VSCTL_CLEANUP])
AT_CHECK([RUN_OVS_VSCTL([remove bridge br1 flood-vlans true])],
[1], [], [ovs-vsctl: "true" is not a valid integer
], [OVS_VSCTL_CLEANUP])
AT_CHECK([RUN_OVS_VSCTL([clear bridge br1 name])],
[1], [], [ovs-vsctl: cannot modify read-only column name in table Bridge
], [OVS_VSCTL_CLEANUP])
Expand Down
14 changes: 9 additions & 5 deletions utilities/ovs-vsctl.c
Expand Up @@ -3528,11 +3528,15 @@ cmd_remove(struct vsctl_context *ctx)
rm_type.n_max = UINT_MAX;
error = ovsdb_datum_from_string(&rm, &rm_type,
ctx->argv[i], ctx->symtab);
if (error && ovsdb_type_is_map(&rm_type)) {
free(error);
rm_type.value.type = OVSDB_TYPE_VOID;
die_if_error(ovsdb_datum_from_string(&rm, &rm_type,
ctx->argv[i], ctx->symtab));
if (error) {
if (ovsdb_type_is_map(&rm_type)) {
rm_type.value.type = OVSDB_TYPE_VOID;
free(error);
die_if_error(ovsdb_datum_from_string(
&rm, &rm_type, ctx->argv[i], ctx->symtab));
} else {
vsctl_fatal("%s", error);
}
}
ovsdb_datum_subtract(&old, type, &rm, &rm_type);
ovsdb_datum_destroy(&rm, &rm_type);
Expand Down

0 comments on commit 89b92e4

Please sign in to comment.