bus: fix assert() on HELLO error-path

Make sure we don't call into any bus_kernel_*() functions before
b->is_kernel is set to true. Hard-code the CMD_FREE just like the other
helpers do.
This commit is contained in:
David Herrmann 2014-12-12 14:02:05 +01:00
parent ec16945ebf
commit 18ee085c15

View file

@ -815,6 +815,10 @@ 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;
@ -982,7 +986,8 @@ int bus_kernel_take_fd(sd_bus *b) {
return bus_start_running(b);
fail:
(void) bus_kernel_cmd_free(b, hello->offset);
cmd_free.offset = hello->offset;
(void) ioctl(b->input_fd, KDBUS_CMD_FREE, &cmd_free);
return r;
}