[CRIU] [PATCH] ghost: Fix off-by-one when printing ghost path

Pavel Emelyanov xemul at parallels.com
Tue Sep 29 07:18:08 PDT 2015


The rfi->path doesn't contain the leading /, neither does the ghost->rpath,
so when attaching it to root don't forget to include one there.

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

---

diff --git a/files-reg.c b/files-reg.c
index 6851d50..f07da31 100644
--- a/files-reg.c
+++ b/files-reg.c
@@ -105,7 +105,7 @@ static int create_ghost(struct ghost_file *gf, GhostFileEntry *gfe, struct cr_im
 		goto err;
 	}
 
-	snprintf(path + ret, sizeof(path) - ret, "%s", gf->remap.rpath);
+	snprintf(path + ret, sizeof(path) - ret, "/%s", gf->remap.rpath);
 	ret = -1;
 
 	if (S_ISFIFO(gfe->mode)) {



More information about the CRIU mailing list