diff options
author | Thomas Hindoe Paaboel Andersen <phomes@gmail.com> | 2014-09-15 22:36:43 +0200 |
---|---|---|
committer | Thomas Hindoe Paaboel Andersen <phomes@gmail.com> | 2014-09-16 21:31:15 +0200 |
commit | b49ffb29ed902f173852707652b3e3c9c303cebb (patch) | |
tree | b7dfbe2f929a0ecea9888e369ca1aa3d71fe0ad8 /src/libsystemd/sd-bus/sd-bus.c | |
parent | d498a616075ebfd8025d66c4c4f725d24eb3aca3 (diff) |
sd-bus: sd_bus_message_get_errno should only return positive errno
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.
Diffstat (limited to 'src/libsystemd/sd-bus/sd-bus.c')
-rw-r--r-- | src/libsystemd/sd-bus/sd-bus.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c index 33b65aba72..28b993b7ba 100644 --- a/src/libsystemd/sd-bus/sd-bus.c +++ b/src/libsystemd/sd-bus/sd-bus.c @@ -349,8 +349,6 @@ static int hello_callback(sd_bus *bus, sd_bus_message *reply, void *userdata, sd assert(reply); r = sd_bus_message_get_errno(reply); - if (r < 0) - return r; if (r > 0) return -r; |