[systemd-devel] [PATCH 1/2] sd-bus: sd_bus_message_get_errno should only return positive errno

David Herrmann dh.herrmann at gmail.com
Tue Sep 16 03:43:57 PDT 2014


Hi

On Mon, Sep 15, 2014 at 11:15 PM, Thomas H.P. Andersen <phomes at gmail.com> wrote:
> From: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
>
> sd_bus_message_get_errno can currently return either a number of
> different poitive errno values (from bus-error-mapping), or a negative
> EINVAL if passed null as parameter.
>
> The check for null parameter was introduced in 40ca29a1370379d43e44c0ed425eecc7218dcbca
> at the same as the function was renamed from bus_message_to_errno and
> made public API. Before becoming public the function used to return
> only negative values.
>
> It is weird to have a function return both positive and negative errno
> and it generally looks like a mistake. The function is guarded by the
> --enable-kdbus flags so I wonder if we still have time to fix it up?
> It does not have any documentation yet. However, except for a few details
> it is just a convenient way to call sd_bus_error_get_errno which is documented
> to return only positive errno.
>
> This patch makes it return only positive errno and fixes up the two
> calls to the function that tried to cope with both positive and negative
> values.

Look both fine with me. And yes, we can still safely break anything
under --enable-kdbus.

Thanks
David


More information about the systemd-devel mailing list