diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-02-13 17:16:51 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-02-13 17:18:36 +0100 |
commit | e044970a29b83e128c5a78f70e7d5ad1c74e7058 (patch) | |
tree | 853960b3fe3a70358a9ba8fe9847e7196467401d /src | |
parent | 95eb099fa8a90212ed2aef82bad360f147bc19c2 (diff) |
sd-bus: initialize a few structs at time or declaration
Diffstat (limited to 'src')
-rw-r--r-- | src/libsystemd/sd-bus/bus-control.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c index 2d51c74cd7..06e5b4fd9a 100644 --- a/src/libsystemd/sd-bus/bus-control.c +++ b/src/libsystemd/sd-bus/bus-control.c @@ -233,16 +233,16 @@ _public_ int sd_bus_release_name(sd_bus *bus, const char *name) { } static int kernel_get_list(sd_bus *bus, uint64_t flags, char ***x) { - struct kdbus_cmd_list cmd = {}; + struct kdbus_cmd_list cmd = { + .size = sizeof(cmd), + .flags = flags, + }; struct kdbus_info *name_list, *name; uint64_t previous_id = 0; int r; /* Caller will free half-constructed list on failure... */ - cmd.size = sizeof(cmd); - cmd.flags = flags; - r = ioctl(bus->input_fd, KDBUS_CMD_LIST, &cmd); if (r < 0) return -errno; @@ -896,7 +896,7 @@ _public_ int sd_bus_get_name_creds( static int bus_get_owner_creds_kdbus(sd_bus *bus, uint64_t mask, sd_bus_creds **ret) { _cleanup_bus_creds_unref_ sd_bus_creds *c = NULL; struct kdbus_cmd_info cmd = { - .size = sizeof(struct kdbus_cmd_info) + .size = sizeof(struct kdbus_cmd_info), }; struct kdbus_info *creator_info; pid_t pid = 0; @@ -1403,7 +1403,10 @@ int bus_remove_match_internal_kernel( sd_bus *bus, uint64_t cookie) { - struct kdbus_cmd_match m; + struct kdbus_cmd_match m = { + .size = offsetof(struct kdbus_cmd_match, items), + .cookie = cookie, + }; int r; assert(bus); @@ -1412,10 +1415,6 @@ int bus_remove_match_internal_kernel( if (bus->hello_flags & KDBUS_HELLO_MONITOR) return 0; - zero(m); - m.size = offsetof(struct kdbus_cmd_match, items); - m.cookie = cookie; - r = ioctl(bus->input_fd, KDBUS_CMD_MATCH_REMOVE, &m); if (r < 0) return -errno; |