diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-11-17 19:24:06 +0100 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2017-11-17 19:24:06 +0100 |
commit | 4949a3907ec926fe478c0914721f9657c4fe847d (patch) | |
tree | c84633d76320b321591b708ea5085c3d0b9ae5bd /src/basic/cgroup-util.c | |
parent | 7bfd0375e4573bbd65deb08511c7cd4a4ffa275c (diff) |
cgroup: properly determine cgroups zombie processes belong to
When a process becomes a zombie its cgroup might be deleted. Let's add
some minimal code to detect cases like this, so that we can still
attribute this back to the original cgroup.
Diffstat (limited to 'src/basic/cgroup-util.c')
-rw-r--r-- | src/basic/cgroup-util.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c index 30bb4664f..71b88f1d3 100644 --- a/src/basic/cgroup-util.c +++ b/src/basic/cgroup-util.c @@ -1118,6 +1118,11 @@ int cg_pid_get_path(const char *controller, pid_t pid, char **path) { if (!p) return -ENOMEM; + /* Truncate suffix indicating the process is a zombie */ + e = endswith(p, " (deleted)"); + if (e) + *e = 0; + *path = p; return 0; } |