SHA256
1
0
forked from pool/systemd
Dr. Werner Fink 2014-03-13 14:18:27 +00:00 committed by Git OBS Bridge
parent c01b5c6470
commit 9bc2ce65c6

View File

@ -27,10 +27,10 @@ Index: systemd-210/src/libsystemd/sd-bus/sd-bus.c
+
+static inline void bus_drop_reply_callback(sd_bus *bus, const struct reply_callback *c)
+{
+ struct reply_callback *cc;
+ struct reply_callback *cc;
+
+ cc = bus_get_reply_callback(bus, c->cookie);
+ assert(cc == NULL || cc == c);
+ cc = bus_get_reply_callback(bus, c->cookie);
+ assert(cc == NULL || cc == c);
+}
+
static int hello_callback(sd_bus *bus, sd_bus_message *reply, void *userdata, sd_bus_error *error) {
@ -41,7 +41,7 @@ Index: systemd-210/src/libsystemd/sd-bus/sd-bus.c
c->timeout = calc_elapse(m->timeout);
- r = hashmap_put(bus->reply_callbacks, &c->cookie, c);
+ r = bus_add_reply_callback(bus, c, c->cookie);
+ r = bus_add_reply_callback(bus, c, c->cookie);
if (r < 0) {
free(c);
return r;
@ -59,7 +59,7 @@ Index: systemd-210/src/libsystemd/sd-bus/sd-bus.c
assert_se(prioq_pop(bus->reply_callbacks_prioq) == c);
- hashmap_remove(bus->reply_callbacks, &c->cookie);
+ bus_drop_reply_callback(bus, c->cookie);
+ bus_drop_reply_callback(bus, c);
bus->current = m;
bus->iteration_counter ++;
@ -68,8 +68,8 @@ Index: systemd-210/src/libsystemd/sd-bus/sd-bus.c
return 0;
- c = hashmap_remove(bus->reply_callbacks, &m->reply_cookie);
+ /* caveat emptor: reply_cookie is 32bit, but the hashmap lookup uses a 64bit
+ * cookie pointer - without type checking, */
+ /* caveat emptor: reply_cookie is 32bit, but the hashmap lookup uses a 64bit
+ * cookie pointer - without type checking, */
+ c = bus_get_reply_callback(bus, m->reply_cookie);
if (!c)
return 0;
@ -79,8 +79,8 @@ Index: systemd-210/src/libsystemd/sd-bus/sd-bus.c
prioq_remove(bus->reply_callbacks_prioq, c, &c->prioq_idx);
- hashmap_remove(bus->reply_callbacks, &c->cookie);
+ /* Remove callback from reply_callbacks hashmap */
+ bus_drop_reply_callback(bus, c->cookie);
+ /* Remove callback from reply_callbacks hashmap */
+ bus_drop_reply_callback(bus, c);
bus->current = m;
bus->iteration_counter++;