summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/bus-error.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-09-14 18:16:54 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-09-14 21:42:22 +0200
commit2a03b9ed21fdbbaef52d9405b46f4967165bef78 (patch)
treed0a11dd7051b41cd0f02b21522543e87c65ffacb /src/libsystemd/sd-bus/bus-error.c
parentad0b610b0c1c2595c32b6235e7ac5ad7fba6e0aa (diff)
downloadsystemd-2a03b9ed21fdbbaef52d9405b46f4967165bef78.tar.gz
tree-wide: don't needlessly negate error number passed to bus_error_message()
Like it's customary in our codebase bus_error_message() internally takes abs() of the passed error anyway, hence no need to explicitly negate it. We mostly got this right, but in too many cases we didn't. Fix that.
Diffstat (limited to 'src/libsystemd/sd-bus/bus-error.c')
-rw-r--r--src/libsystemd/sd-bus/bus-error.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
index e7a93d3a5a..83de996b25 100644
--- a/src/libsystemd/sd-bus/bus-error.c
+++ b/src/libsystemd/sd-bus/bus-error.c
@@ -581,10 +581,7 @@ const char *bus_error_message(const sd_bus_error *e, int error) {
return e->message;
}
- if (error < 0)
- error = -error;
-
- return strerror_safe(error);
+ return strerror_safe(abs(error));
}
static bool map_ok(const sd_bus_error_map *map) {