summaryrefslogtreecommitdiff
path: root/src/bus-driverd/bus-driverd.c
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2014-01-08 21:32:37 +0800
committerKay Sievers <kay@vrfy.org>2014-01-08 21:38:20 +0800
commit234e28aa1cd37dee597c719ac5ca004c6215d28c (patch)
tree16ccdb77d75c36de371110837dad21afc3316c5e /src/bus-driverd/bus-driverd.c
parent743e7e5242b72dac182b4c15ff3a48be83277ece (diff)
bus-driverd: do not track identical matches
Identical matches are only one time in the hash map but multiple times in the list; when removing, the hash will be empty but the list still has entries. Not adding dupicates to the list should keep us in sync and prevent hitting the assert.
Diffstat (limited to 'src/bus-driverd/bus-driverd.c')
-rw-r--r--src/bus-driverd/bus-driverd.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/bus-driverd/bus-driverd.c b/src/bus-driverd/bus-driverd.c
index 7e0ad1e0c0..46a5b10974 100644
--- a/src/bus-driverd/bus-driverd.c
+++ b/src/bus-driverd/bus-driverd.c
@@ -130,7 +130,10 @@ static int match_new(Client *c, struct bus_match_component *components, unsigned
first = hashmap_get(c->matches, m->match);
LIST_PREPEND(matches, first, m);
r = hashmap_replace(c->matches, m->match, first);
- if (r < 0) {
+ if (r == 0) {
+ log_debug("Match '%s' already installed, ignoring request.", m->match);
+ LIST_REMOVE(matches, first, m);
+ } else if (r < 0) {
LIST_REMOVE(matches, first, m);
goto fail;
}