summaryrefslogtreecommitdiff
path: root/src/shared/cgroup-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-04-16 18:56:18 +0200
committerLennart Poettering <lennart@poettering.net>2012-04-16 18:59:40 +0200
commitb69d29ce049f12d463a589e18561dd10ee8c09f1 (patch)
tree8990e2d696fd91de9886c0d60bc41ba98a299e2f /src/shared/cgroup-util.c
parent888c7102355af1450aa26253d60cc2cb46eeb71d (diff)
systemctl: show main and control PID explicitly in cgroup-show
In some cases the main/control PID of a service can be outside of the services cgroups (for example, if logind readjusts the processes' cgroup). In order to clarify this for the user show the main/control PID in the cgroup tree nonetheless, but mark them specially.
Diffstat (limited to 'src/shared/cgroup-util.c')
-rw-r--r--src/shared/cgroup-util.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c
index 48da4cb3b7..8ceb382820 100644
--- a/src/shared/cgroup-util.c
+++ b/src/shared/cgroup-util.c
@@ -1050,11 +1050,11 @@ int cg_fix_path(const char *path, char **result) {
assert(result);
/* First check if it already is a filesystem path */
- if (path_is_absolute(path) &&
- path_startswith(path, "/sys/fs/cgroup") &&
+ if (path_startswith(path, "/sys/fs/cgroup") &&
access(path, F_OK) >= 0) {
- if (!(t = strdup(path)))
+ t = strdup(path);
+ if (!t)
return -ENOMEM;
*result = t;
@@ -1062,7 +1062,8 @@ int cg_fix_path(const char *path, char **result) {
}
/* Otherwise treat it as cg spec */
- if ((r = cg_split_spec(path, &c, &p)) < 0)
+ r = cg_split_spec(path, &c, &p);
+ if (r < 0)
return r;
r = cg_get_path(c ? c : SYSTEMD_CGROUP_CONTROLLER, p ? p : "/", NULL, result);