[CRIU] [PATCH] cg: don't save cgroup directories twice

Tycho Andersen tycho.andersen at canonical.com
Thu Jul 10 14:16:24 PDT 2014


The path in cc->path here always has a "/" prefix since it comes from
/proc/$pid/cgroup. The additional / confuses the string slinging because ftw()
normalizes paths to have one "/" when we start traversing a subdirectory.

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 cgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cgroup.c b/cgroup.c
index 5114935..8be8569 100644
--- a/cgroup.c
+++ b/cgroup.c
@@ -385,7 +385,7 @@ static int collect_cgroups(struct list_head *ctls)
 			strcpy(mount_point, prefix);
 		}
 
-		snprintf(path, PATH_MAX, "%s/%s", mount_point, cc->path);
+		snprintf(path, PATH_MAX, "%s%s", mount_point, cc->path);
 
 		current_controller = NULL;
 
-- 
1.9.1



More information about the CRIU mailing list