[CRIU] [PATCH] cgroup: update cgns prefix *after* using it

Tycho Andersen tycho.andersen at canonical.com
Mon Oct 31 12:07:10 PDT 2016


We're using the old cgns prefix length in allocating dirnew, so let's not
update it before that.

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

diff --git a/criu/cgroup.c b/criu/cgroup.c
index caa8033..5f8e84e 100644
--- a/criu/cgroup.c
+++ b/criu/cgroup.c
@@ -1712,7 +1712,6 @@ static int rewrite_cgsets(CgroupEntry *cge, char **controllers, int n_controller
 					return -ENOMEM;
 				}
 				xfree(prev);
-				cg->cgns_prefix = strlen(newroot);
 
 				if (!dirnew) {
 					/* -1 because cgns_prefix includes leading "/" */
@@ -1720,6 +1719,7 @@ static int rewrite_cgsets(CgroupEntry *cge, char **controllers, int n_controller
 					if (!dirnew)
 						return -ENOMEM;
 				}
+				cg->cgns_prefix = strlen(newroot);
 			} else {
 				char *prev = cg->path;
 				/*
-- 
2.7.4



More information about the CRIU mailing list