sd-bus: internalize setting of bus is_system/is_user

Each of bus_set_address_{user,system} had two users, and each of the two users
would set the internal flag manually. We should do that internally in the
functions instead.

While at it, only set the flag when setting the address is actually successful.
This doesn't change anything for current users, but it seems more correct.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2020-05-25 11:09:21 +02:00
parent 0406d1a843
commit 062ac2ea85
2 changed files with 14 additions and 9 deletions
+2 -5
View File
@@ -110,13 +110,10 @@ static int acquire_bus(bool set_monitor, sd_bus **ret) {
switch (arg_transport) {
case BUS_TRANSPORT_LOCAL:
if (arg_user) {
bus->is_user = true;
if (arg_user)
r = bus_set_address_user(bus);
} else {
bus->is_system = true;
else
r = bus_set_address_system(bus);
}
break;
case BUS_TRANSPORT_REMOTE: