summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
Diffstat (limited to 'src/login')
-rw-r--r--src/login/loginctl.c25
1 files changed, 3 insertions, 22 deletions
diff --git a/src/login/loginctl.c b/src/login/loginctl.c
index 4c618ed19e..1aac7ae979 100644
--- a/src/login/loginctl.c
+++ b/src/login/loginctl.c
@@ -240,7 +240,6 @@ static int list_seats(int argc, char *argv[], void *userdata) {
sd_bus *bus = userdata;
unsigned k = 0;
int r;
-
assert(bus);
assert(argv);
@@ -280,35 +279,17 @@ static int list_seats(int argc, char *argv[], void *userdata) {
}
static int show_unit_cgroup(sd_bus *bus, const char *interface, const char *unit, pid_t leader) {
+ _cleanup_free_ char *cgroup = NULL;
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
- _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
- _cleanup_free_ char *path = NULL;
- const char *cgroup;
unsigned c;
int r;
assert(bus);
assert(unit);
- path = unit_dbus_path_from_name(unit);
- if (!path)
- return log_oom();
-
- r = sd_bus_get_property(
- bus,
- "org.freedesktop.systemd1",
- path,
- interface,
- "ControlGroup",
- &error,
- &reply,
- "s");
- if (r < 0)
- return log_error_errno(r, "Failed to query ControlGroup: %s", bus_error_message(&error, r));
-
- r = sd_bus_message_read(reply, "s", &cgroup);
+ r = show_cgroup_get_unit_path_and_warn(bus, unit, &cgroup);
if (r < 0)
- return bus_log_parse_error(r);
+ return r;
if (isempty(cgroup))
return 0;