diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-01-26 17:48:14 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-01-26 21:52:07 +0100 |
commit | 72e6110485926c884f056717a21e4f5f3942908c (patch) | |
tree | 4b5ebf4a789ccbc17fbb3473fe27aa43042b4ac7 | |
parent | cc98b3025eeb89addb76a27390cb2baca4eab8b9 (diff) |
sd-bus: reuse the KDBUS_CMD_FREE wrapper wherever appropriate
-rw-r--r-- | src/libsystemd/sd-bus/bus-kernel.c | 9 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-message.c | 10 |
2 files changed, 3 insertions, 16 deletions
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c index e73a5077b5..b4d0af102f 100644 --- a/src/libsystemd/sd-bus/bus-kernel.c +++ b/src/libsystemd/sd-bus/bus-kernel.c @@ -822,10 +822,6 @@ fail: } int bus_kernel_take_fd(sd_bus *b) { - struct kdbus_cmd_free cmd_free = { - .size = sizeof(cmd_free), - .flags = 0, - }; struct kdbus_bloom_parameter *bloom = NULL; struct kdbus_cmd_hello *hello; struct kdbus_item_list *items; @@ -989,12 +985,10 @@ int bus_kernel_take_fd(sd_bus *b) { /* free returned items */ (void) bus_kernel_cmd_free(b, hello->offset); - return bus_start_running(b); fail: - cmd_free.offset = hello->offset; - (void) ioctl(b->input_fd, KDBUS_CMD_FREE, &cmd_free); + (void) bus_kernel_cmd_free(b, hello->offset); return r; } @@ -1019,7 +1013,6 @@ int bus_kernel_connect(sd_bus *b) { int bus_kernel_cmd_free(sd_bus *bus, uint64_t offset) { struct kdbus_cmd_free cmd = { .size = sizeof(cmd), - .flags = 0, .offset = offset, }; int r; diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c index 9ae65bebc8..3f2d6e74c5 100644 --- a/src/libsystemd/sd-bus/bus-message.c +++ b/src/libsystemd/sd-bus/bus-message.c @@ -129,14 +129,8 @@ static void message_free(sd_bus_message *m) { message_reset_parts(m); - if (m->release_kdbus) { - struct kdbus_cmd_free cmd_free = { }; - - cmd_free.size = sizeof(cmd_free); - cmd_free.flags = 0; - cmd_free.offset = (uint8_t *)m->kdbus - (uint8_t *)m->bus->kdbus_buffer; - (void) ioctl(m->bus->input_fd, KDBUS_CMD_FREE, &cmd_free); - } + if (m->release_kdbus) + bus_kernel_cmd_free(m->bus, (uint8_t *) m->kdbus - (uint8_t *) m->bus->kdbus_buffer); if (m->free_kdbus) free(m->kdbus); |