[CRIU] [PATCH 2/3] cg: Keep "/" in cgroup root paths

Pavel Emelyanov xemul at parallels.com
Wed Jul 16 08:49:28 PDT 2014


The ftw trims tail "/" from path argument.

Signed-off-by: Pavel Emelyanov <xemul at parallels.com>

---
 cgroup.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/cgroup.c b/cgroup.c
index fcd57fc..46dd4b4 100644
--- a/cgroup.c
+++ b/cgroup.c
@@ -244,7 +244,11 @@ static int add_cgroup(const char *fpath, const struct stat *sb, int typeflag)
 		}
 
 		/* chop off the first "/proc/self/fd/N" str */
-		ncd->path = xstrdup(fpath + path_pref_len);
+		if (fpath[path_pref_len] == '\0')
+			ncd->path = xstrdup("/");
+		else
+			ncd->path = xstrdup(fpath + path_pref_len);
+
 		if (!ncd->path) {
 			ret = -1;
 			goto out;
-- 
1.8.4.2




More information about the CRIU mailing list