sd-bus: add custom return code when $XDG_RUNTIME_DIR is not set

We would return ENOENT, which is extremely confusing. Strace is not helpful because
no *file* is actually missing. So let's add some logs at debug level and also use
a custom return code. Let all user-facing utilities print a custom error message
in that case.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2020-10-14 18:28:30 +02:00
parent 165fee860a
commit ab4a88eb92
10 changed files with 28 additions and 14 deletions
+2 -2
View File
@@ -129,11 +129,11 @@ static int acquire_bus(bool set_monitor, sd_bus **ret) {
}
}
if (r < 0)
return log_error_errno(r, "Failed to set address: %m");
return bus_log_address_error(r);
r = sd_bus_start(bus);
if (r < 0)
return log_error_errno(r, "Failed to connect to bus: %m");
return bus_log_connect_error(r);
*ret = TAKE_PTR(bus);