From c966ef4a7678c4040884a5e644132660e72cd6d9 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 17 Dec 2013 20:39:15 +0100 Subject: bus: properly return an error code when release_name fails abnormally --- src/bus-driverd/bus-driverd.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/bus-driverd/bus-driverd.c') 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) -- cgit v1.2.3-54-g00ecf