]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/bus-util: debug log when falling back to session bus
authorMike Yuan <me@yhndnzj.com>
Tue, 22 Oct 2024 17:18:10 +0000 (19:18 +0200)
committerMike Yuan <me@yhndnzj.com>
Tue, 22 Oct 2024 17:19:46 +0000 (19:19 +0200)
Follow-up for d0316b7a0d356ba12325ce5a00b0cbe0bc359461

src/shared/bus-util.c

index ce94597955aa3bfdfe88239fe34ed59763269bfe..ff80e580fc3ea4cde7f8fdd468ba0a3511ad1cdb 100644 (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. */
                                 return log_error_errno(SYNTHETIC_ERRNO(EHOSTDOWN),
                                                        "System has not been booted with systemd as init system (PID 1). Can't operate.");
+
                         r = sd_bus_default_system(&bus);
                         break;
 
@@ -515,8 +516,10 @@ int bus_connect_transport_systemd(
                          * 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
                          * 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);
+                        }
 
                         return r;