diff options
author | Daan De Meyer <daan.j.demeyer@gmail.com> | 2024-10-08 16:22:58 +0200 |
---|---|---|
committer | Daan De Meyer <daan.j.demeyer@gmail.com> | 2024-10-09 10:27:53 +0200 |
commit | d8a77d55e6ad7f251ae0eb6758af6bba111095df (patch) | |
tree | cf29ac5b033275192d37610e540ee7da104638d6 /src/cgls | |
parent | Merge pull request #34639 from DaanDeMeyer/repart-fix (diff) | |
download | systemd-d8a77d55e6ad7f251ae0eb6758af6bba111095df.tar.xz systemd-d8a77d55e6ad7f251ae0eb6758af6bba111095df.zip |
bus-util: Log more information when connecting to a bus socket fails
Let's log about which bus we're trying to connect to and what transport
we're using to do it.
Diffstat (limited to 'src/cgls')
-rw-r--r-- | src/cgls/cgls.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/cgls/cgls.c b/src/cgls/cgls.c index 70fa260246..1dcd316cdb 100644 --- a/src/cgls/cgls.c +++ b/src/cgls/cgls.c @@ -221,13 +221,12 @@ static int run(int argc, char *argv[]) { return log_error_errno(r, "Failed to mangle unit name: %m"); if (!bus) { + RuntimeScope scope = arg_show_unit == SHOW_UNIT_USER ? RUNTIME_SCOPE_USER : RUNTIME_SCOPE_SYSTEM; + /* Connect to the bus only if necessary */ - r = bus_connect_transport_systemd( - BUS_TRANSPORT_LOCAL, NULL, - arg_show_unit == SHOW_UNIT_USER ? RUNTIME_SCOPE_USER : RUNTIME_SCOPE_SYSTEM, - &bus); + r = bus_connect_transport_systemd(BUS_TRANSPORT_LOCAL, NULL, scope, &bus); if (r < 0) - return bus_log_connect_error(r, BUS_TRANSPORT_LOCAL); + return bus_log_connect_error(r, BUS_TRANSPORT_LOCAL, scope); } q = show_cgroup_get_unit_path_and_warn(bus, unit_name, &cgroup); |