1
0
mirror of https://github.com/systemd/systemd.git synced 2025-09-16 17:45:36 +03:00

shared/bus-util: debug log when falling back to session bus

Follow-up for d0316b7a0d
This commit is contained in:
Mike Yuan
2024-10-22 19:18:10 +02:00
parent d845254b7f
commit c240f293b8

View File

@@ -439,6 +439,7 @@ int bus_connect_transport(
/* Print a friendly message when the local system is actually not running systemd as PID 1. */ /* Print a friendly message when the local system is actually not running systemd as PID 1. */
return log_error_errno(SYNTHETIC_ERRNO(EHOSTDOWN), return log_error_errno(SYNTHETIC_ERRNO(EHOSTDOWN),
"System has not been booted with systemd as init system (PID 1). Can't operate."); "System has not been booted with systemd as init system (PID 1). Can't operate.");
r = sd_bus_default_system(&bus); r = sd_bus_default_system(&bus);
break; break;
@@ -515,8 +516,10 @@ int bus_connect_transport_systemd(
* private manager bus. To keep compat with existing code that was setting * private manager bus. To keep compat with existing code that was setting
* DBUS_SESSION_BUS_ADDRESS without setting XDG_RUNTIME_DIR, connect to the user * DBUS_SESSION_BUS_ADDRESS without setting XDG_RUNTIME_DIR, connect to the user
* session bus if DBUS_SESSION_BUS_ADDRESS is set and XDG_RUNTIME_DIR isn't. */ * session bus if DBUS_SESSION_BUS_ADDRESS is set and XDG_RUNTIME_DIR isn't. */
if (r == -ENOMEDIUM && secure_getenv("DBUS_SESSION_BUS_ADDRESS")) if (r == -ENOMEDIUM && secure_getenv("DBUS_SESSION_BUS_ADDRESS")) {
log_debug_errno(r, "$XDG_RUNTIME_DIR not set, unable to connect to private bus. Falling back to session bus.");
r = sd_bus_default_user(ret_bus); r = sd_bus_default_user(ret_bus);
}
return r; return r;