From 320814811417146cfa1e416f69f1101eed630c36 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 3 Feb 2015 20:07:37 -0500 Subject: cg_path_get_user_unit(): Did not correctly parse user-unit templates. It ran either skip_session() or skip_user_manager(), then ran skip_slices() iff skip_session() ran. It needs to run skip_slices() in either case. Included is a test case demonstrating why. --- src/shared/cgroup-util.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src/shared/cgroup-util.c') diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c index b527868e6b..dfd8689b72 100644 --- a/src/shared/cgroup-util.c +++ b/src/shared/cgroup-util.c @@ -1251,17 +1251,15 @@ int cg_path_get_user_unit(const char *path, char **unit) { /* Skip slices, if there are any */ e = skip_slices(path); - /* Skip the session scope... */ + /* Skip the session scope or user manager... */ t = skip_session(e); - if (t) - /* ... and skip more slices if there's one */ - e = skip_slices(t); - else { - /* ... or require a user manager unit to be there */ - e = skip_user_manager(e); - if (!e) - return -ENOENT; - } + if (!t) + t = skip_user_manager(e); + if (!t) + return -ENOENT; + + /* ... and skip more slices if there are any */ + e = skip_slices(t); return cg_path_decode_unit(e, unit); } -- cgit v1.2.3-54-g00ecf