1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-26 03:22:00 +03:00

stdio-bridge: return immediately if we can

Follow-up for 0321248b79.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2023-11-29 14:38:06 +01:00
parent 9ce3440a6f
commit ccd31de8bf

View File

@ -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);