diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-11-29 14:38:06 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-12-02 09:47:45 +0100 |
commit | ccd31de8bf4717f0dd889c97440b4037909eb3bc (patch) | |
tree | 00c66b071f7909c8553b01d5ae0cd15b8049cf3a /src/stdio-bridge | |
parent | run: fix bad escaping and memory ownership confusion (diff) | |
download | systemd-ccd31de8bf4717f0dd889c97440b4037909eb3bc.tar.xz systemd-ccd31de8bf4717f0dd889c97440b4037909eb3bc.zip |
stdio-bridge: return immediately if we can
Follow-up for 0321248b79d14ceddd36140b327332f145ae68e7.
Diffstat (limited to 'src/stdio-bridge')
-rw-r--r-- | src/stdio-bridge/stdio-bridge.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/stdio-bridge/stdio-bridge.c b/src/stdio-bridge/stdio-bridge.c index ce2bd5f86f..fe551cfaea 100644 --- a/src/stdio-bridge/stdio-bridge.c +++ b/src/stdio-bridge/stdio-bridge.c @@ -183,12 +183,12 @@ static int run(int argc, char *argv[]) { r = sd_bus_process(a, &m); if (ERRNO_IS_NEG_DISCONNECT(r)) /* Treat 'connection reset by peer' as clean exit condition */ - break; + return 0; if (r < 0) return log_error_errno(r, "Failed to process bus a: %m"); if (m) { if (sd_bus_message_is_signal(m, "org.freedesktop.DBus.Local", "Disconnected")) - break; + return 0; r = sd_bus_send(b, m, NULL); if (r < 0) @@ -200,12 +200,12 @@ static int run(int argc, char *argv[]) { r = sd_bus_process(b, &m); if (ERRNO_IS_NEG_DISCONNECT(r)) /* Treat 'connection reset by peer' as clean exit condition */ - break; + return 0; if (r < 0) return log_error_errno(r, "Failed to process bus: %m"); if (m) { if (sd_bus_message_is_signal(m, "org.freedesktop.DBus.Local", "Disconnected")) - break; + return 0; r = sd_bus_send(a, m, NULL); if (r < 0) @@ -247,8 +247,6 @@ static int run(int argc, char *argv[]) { if (r < 0 && !ERRNO_IS_TRANSIENT(r)) /* don't be bothered by signals, i.e. EINTR */ return log_error_errno(r, "ppoll() failed: %m"); } - - return 0; } DEFINE_MAIN_FUNCTION(run); |