From: Lennart Poettering Date: Tue, 19 Mar 2019 12:02:21 +0000 (+0100) Subject: stdio-bridge: use ERRNO_IS_DISCONNECT() to detect disconnects X-Git-Tag: v242-rc1~106^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e17e5c2bf494323ff57ad3a09bf238de4fcc4db;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/stdio-bridge/stdio-bridge.c b/src/stdio-bridge/stdio-bridge.c index 7060897ab7b..1767515e3e4 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);