X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flibsystemd%2Fsd-bus%2Fbus-match.c;h=5658c61ba789fba1529c99112bb4be8159f90b69;hb=ef7b6c0190fefaacf6d8f8e1a6dda4ba8b98091b;hp=3391b1a1b6e47671488aecff34fc8db57e3fe94f;hpb=1b64f8382956cdd9a2afc50a7ab638529acb912e;p=elogind.git diff --git a/src/libsystemd/sd-bus/bus-match.c b/src/libsystemd/sd-bus/bus-match.c index 3391b1a1b..5658c61ba 100644 --- a/src/libsystemd/sd-bus/bus-match.c +++ b/src/libsystemd/sd-bus/bus-match.c @@ -289,16 +289,22 @@ int bus_match_run( return r; /* Run the callback. And then invoke siblings. */ - if (node->leaf.callback) { + if (node->leaf.callback->callback) { _cleanup_bus_error_free_ sd_bus_error error_buffer = SD_BUS_ERROR_NULL; sd_bus_slot *slot; slot = container_of(node->leaf.callback, sd_bus_slot, match_callback); - if (bus) + if (bus) { bus->current_slot = sd_bus_slot_ref(slot); + bus->current_handler = node->leaf.callback->callback; + bus->current_userdata = slot->userdata; + } r = node->leaf.callback->callback(bus, m, slot->userdata, &error_buffer); - if (bus) + if (bus) { + bus->current_userdata = NULL; + bus->current_handler = NULL; bus->current_slot = sd_bus_slot_unref(slot); + } r = bus_maybe_reply_error(m, r, &error_buffer); if (r != 0) @@ -444,13 +450,13 @@ static int bus_match_add_compare_value( where->child = c; if (t == BUS_MATCH_MESSAGE_TYPE) { - c->compare.children = hashmap_new(trivial_hash_func, trivial_compare_func); + c->compare.children = hashmap_new(NULL); if (!c->compare.children) { r = -ENOMEM; goto fail; } } else if (BUS_MATCH_CAN_HASH(t)) { - c->compare.children = hashmap_new(string_hash_func, string_compare_func); + c->compare.children = hashmap_new(&string_hash_ops); if (!c->compare.children) { r = -ENOMEM; goto fail; @@ -531,7 +537,7 @@ static int bus_match_find_compare_value( else if (BUS_MATCH_CAN_HASH(t)) n = hashmap_get(c->compare.children, value_str); else { - for (n = c->child; !value_node_same(n, t, value_u8, value_str); n = n->next) + for (n = c->child; n && !value_node_same(n, t, value_u8, value_str); n = n->next) ; }