diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-11-26 14:59:12 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-11-26 14:59:12 +0100 |
commit | e12d81ae80214ef05ddedafd016bdd604ce17d12 (patch) | |
tree | 55d8b2a5dd356154b24ab8c8a5c5287196d5176a /src/libsystemd/sd-bus/bus-kernel.c | |
parent | 8514b67754c5ff7fa628929b3d27131010c21842 (diff) |
sd-bus: given that the kernel now passes the auxgroups list as 32bit array to us, no need to convert to uid_t manually
This way, we can save one allocation and avoid copying the array
unnecesarily.
Diffstat (limited to 'src/libsystemd/sd-bus/bus-kernel.c')
-rw-r--r-- | src/libsystemd/sd-bus/bus-kernel.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c index 907c5c5cf6..2beaa892bc 100644 --- a/src/libsystemd/sd-bus/bus-kernel.c +++ b/src/libsystemd/sd-bus/bus-kernel.c @@ -677,21 +677,10 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) { case KDBUS_ITEM_AUXGROUPS: if (bus->creds_mask & SD_BUS_CREDS_SUPPLEMENTARY_GIDS) { - size_t i, n; - uid_t *u; - n = (d->size - offsetof(struct kdbus_item, data32)) / sizeof(uint32_t); - u = new(uid_t, n); - if (!u) { - r = -ENOMEM; - goto fail; - } - - for (i = 0; i < n; i++) - u[i] = (uid_t) d->data32[i]; - - m->creds.supplementary_gids = u; - m->creds.n_supplementary_gids = n; + assert_cc(sizeof(gid_t) == sizeof(uint32_t)); + m->creds.n_supplementary_gids = (d->size - offsetof(struct kdbus_item, data32)) / sizeof(uint32_t); + m->creds.supplementary_gids = (gid_t*) d->data32; m->creds.mask |= SD_BUS_CREDS_SUPPLEMENTARY_GIDS; } |