mirror of
https://github.com/systemd/systemd.git
synced 2025-01-10 05:18:17 +03:00
stdio-bridge: properly handle org.freedesktop.DBus.Local.Disconnected signal
Previously, we'd forward org.freedesktop.DBus.Local.Disconnected like any other message to the other side. But that's not OK, as messages in the org.freedesktop.DBus.Local.* namespace are supposed to never touch the wire, and are synthetic messages that the library uses to communicate with the app, but never with other apps. dbus-daemon never cared, but dbus-broker complains about this, hence clean this up. See: #28514
This commit is contained in:
parent
ec43827bf7
commit
0321248b79
@ -182,10 +182,14 @@ static int run(int argc, char *argv[]) {
|
|||||||
assert_cc(sizeof(usec_t) == sizeof(uint64_t));
|
assert_cc(sizeof(usec_t) == sizeof(uint64_t));
|
||||||
|
|
||||||
r = sd_bus_process(a, &m);
|
r = sd_bus_process(a, &m);
|
||||||
|
if (ERRNO_IS_NEG_DISCONNECT(r)) /* Treat 'connection reset by peer' as clean exit condition */
|
||||||
|
break;
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to process bus a: %m");
|
return log_error_errno(r, "Failed to process bus a: %m");
|
||||||
|
|
||||||
if (m) {
|
if (m) {
|
||||||
|
if (sd_bus_message_is_signal(m, "org.freedesktop.DBus.Local", "Disconnected"))
|
||||||
|
break;
|
||||||
|
|
||||||
r = sd_bus_send(b, m, NULL);
|
r = sd_bus_send(b, m, NULL);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to send message: %m");
|
return log_error_errno(r, "Failed to send message: %m");
|
||||||
@ -195,13 +199,14 @@ static int run(int argc, char *argv[]) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
r = sd_bus_process(b, &m);
|
r = sd_bus_process(b, &m);
|
||||||
if (ERRNO_IS_NEG_DISCONNECT(r))
|
if (ERRNO_IS_NEG_DISCONNECT(r)) /* Treat 'connection reset by peer' as clean exit condition */
|
||||||
/* Treat 'connection reset by peer' as clean exit condition */
|
break;
|
||||||
return 0;
|
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to process bus: %m");
|
return log_error_errno(r, "Failed to process bus: %m");
|
||||||
|
|
||||||
if (m) {
|
if (m) {
|
||||||
|
if (sd_bus_message_is_signal(m, "org.freedesktop.DBus.Local", "Disconnected"))
|
||||||
|
break;
|
||||||
|
|
||||||
r = sd_bus_send(a, m, NULL);
|
r = sd_bus_send(a, m, NULL);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to send message: %m");
|
return log_error_errno(r, "Failed to send message: %m");
|
||||||
|
Loading…
Reference in New Issue
Block a user