projects
/
openvswitch
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make unixctl_command_register() idempotent
[openvswitch]
/
lib
/
unixctl.c
diff --git
a/lib/unixctl.c
b/lib/unixctl.c
index 7cc7e5e234a6ee4e45d79ededbf8e150c488d68a..d75166fe424117c0a5d3703c6223a0bc1cfb3343 100644
(file)
--- a/
lib/unixctl.c
+++ b/
lib/unixctl.c
@@
-115,9
+115,14
@@
unixctl_command_register(const char *name, const char *args,
unixctl_cb_func *cb, void *aux)
{
struct unixctl_command *command;
unixctl_cb_func *cb, void *aux)
{
struct unixctl_command *command;
+ struct unixctl_command *lookup = shash_find_data(&commands, name);
+
+ assert(!lookup || lookup->cb == cb);
+
+ if (lookup) {
+ return;
+ }
- assert(!shash_find_data(&commands, name)
- || shash_find_data(&commands, name) == cb);
command = xmalloc(sizeof *command);
command->args = args;
command->cb = cb;
command = xmalloc(sizeof *command);
command->args = args;
command->cb = cb;