X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Fcgroup-util.c;h=dfd8689b72a88a5e58ce6049d8c9ee09abd564d1;hb=5c3072eab6d2e11d89452987b017541d4654ac05;hp=0d3cc53517de07b7ef779ea5c219f7a052cd566d;hpb=934277fe6a26ff2a4da37059c70d84ab6a700781;p=elogind.git diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c index 0d3cc5351..dfd8689b7 100644 --- a/src/shared/cgroup-util.c +++ b/src/shared/cgroup-util.c @@ -510,7 +510,7 @@ static int check_hierarchy(const char *p) { return 0; /* Check if this controller actually really exists */ - cc = strappenda("/sys/fs/cgroup/", p); + cc = strjoina("/sys/fs/cgroup/", p); if (laccess(cc, F_OK) < 0) return -errno; @@ -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); }