diff options
author | Lennart Poettering <lennart@poettering.net> | 2019-03-19 13:02:21 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2019-03-19 15:29:44 +0100 |
commit | 4e17e5c2bf494323ff57ad3a09bf238de4fcc4db (patch) | |
tree | 9f2337ac202cc08f994329408849aecf9df62143 /src/stdio-bridge | |
parent | util: move ERRNO_IS_xyz macros to errno-util.h (diff) | |
download | systemd-4e17e5c2bf494323ff57ad3a09bf238de4fcc4db.tar.xz systemd-4e17e5c2bf494323ff57ad3a09bf238de4fcc4db.zip |
stdio-bridge: use ERRNO_IS_DISCONNECT() to detect disconnects
Let's use the macro we already have to make this safer. Moreover log
about all other errors.
Diffstat (limited to 'src/stdio-bridge')
-rw-r--r-- | src/stdio-bridge/stdio-bridge.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/stdio-bridge/stdio-bridge.c b/src/stdio-bridge/stdio-bridge.c index 7060897ab7..1767515e3e 100644 --- a/src/stdio-bridge/stdio-bridge.c +++ b/src/stdio-bridge/stdio-bridge.c @@ -14,6 +14,7 @@ #include "build.h" #include "bus-internal.h" #include "bus-util.h" +#include "errno-util.h" #include "log.h" #include "main-func.h" #include "util.h" @@ -187,9 +188,13 @@ static int run(int argc, char *argv[]) { continue; r = sd_bus_process(b, &m); - if (r < 0) + if (r < 0) { /* treat 'connection reset by peer' as clean exit condition */ - return r == -ECONNRESET ? 0 : r; + if (ERRNO_IS_DISCONNECT(r)) + return 0; + + return log_error_errno(r, "Failed to process bus: %m"); + } if (m) { r = sd_bus_send(a, m, NULL); |