diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-12-17 20:39:15 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-12-17 20:39:15 +0100 |
commit | c966ef4a7678c4040884a5e644132660e72cd6d9 (patch) | |
tree | 2677b8b69ab0beb865190e6255c7c656eb547256 | |
parent | 3263ef39b89080cacccaf9b7b36675490a282f2d (diff) |
bus: properly return an error code when release_name fails abnormally
-rw-r--r-- | src/bus-driverd/bus-driverd.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/bus-driverd/bus-driverd.c b/src/bus-driverd/bus-driverd.c index a1ad0504c3..ccb1fb3710 100644 --- a/src/bus-driverd/bus-driverd.c +++ b/src/bus-driverd/bus-driverd.c @@ -333,8 +333,7 @@ static int driver_request_name(sd_bus *bus, sd_bus_message *m, void *userdata, s size = sizeof(*cmd_name) + strlen(name) + 1; - cmd_name = alloca(size); - memset(cmd_name, 0, size); + cmd_name = alloca0(size); strcpy(cmd_name->name, name); cmd_name->size = size; kdbus_translate_request_name_flags(flags, (uint64_t *) &cmd_name->conn_flags); @@ -353,8 +352,8 @@ static int driver_request_name(sd_bus *bus, sd_bus_message *m, void *userdata, s return sd_bus_reply_method_return(m, "u", BUS_NAME_EXISTS); else if (errno == EALREADY) return sd_bus_reply_method_return(m, "u", BUS_NAME_ALREADY_OWNER); - else - return sd_bus_reply_method_return(m, "u", -errno); + + return -errno; } if (cmd_name->flags & KDBUS_NAME_IN_QUEUE) |