[systemd-devel] [PATCH] bus-driverd: Fix return code in driver_request_name
Lukasz Skalski
l.skalski at partner.samsung.com
Tue Dec 17 05:21:34 PST 2013
Please ignore this patch - it contains errors. Sorry.
BR,
Lukasz
On 12/17/2013 01:48 PM, Lukasz Skalski wrote:
> RequestName return codes should be consistent with
> Dbus Specification.
>
> VALUE - DESCRIPTION
> 1 - The caller is now the primary owner of the name, replacing any previous owner,
> 2 - The name already had an owner (QUEUE flag was not specified),
> 3 - The name already has an owner (QUEUE flag was specified),
> 4 - Application trying to request ownership of a name is already the owner of it.
> ---
> src/bus-driverd/bus-driverd.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/src/bus-driverd/bus-driverd.c b/src/bus-driverd/bus-driverd.c
> index d2b3e08..36d90df 100644
> --- a/src/bus-driverd/bus-driverd.c
> +++ b/src/bus-driverd/bus-driverd.c
> @@ -403,10 +403,16 @@ static int driver_request_name(sd_bus *bus, sd_bus_message *m, void *userdata, s
> cmd_name->id = id;
>
> r = ioctl(sd_bus_get_fd(bus), KDBUS_CMD_NAME_ACQUIRE, cmd_name);
> - if (r < 0)
> - return r;
>
> - return sd_bus_reply_method_return(m, "u", 0);
> + if (r == EEXIST)
> + return sd_bus_reply_method_return(m, "u", 3);
> + else if (r == EALREADY)
> + return sd_bus_reply_method_return(m, "u", 4);
> + else if (r == 0)
> + return sd_bus_reply_method_return(m, "u", 2);
> + else
> + return sd_bus_reply_method_return(m, "u", 1);
> +
> }
>
> static int driver_start_service_by_name(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bus_error *error) {
>
--
Lukasz Skalski
Samsung R&D Institute Poland
Samsung Electronics
l.skalski at partner.samsung.com
More information about the systemd-devel
mailing list