[CRIU] [PATCH] reg-files: Don't mangle ghost directories

Cyrill Gorcunov gorcunov at openvz.org
Thu Oct 23 09:19:53 PDT 2014


Because directories are opened via direct mkdir
call with name taken from ghost path don't postfix
it with cr.%x.ghost, otherwise that's the name
directory will have after restore complete causing
cwd01 test to fail.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 files-reg.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/files-reg.c b/files-reg.c
index 47a79881a9b5..5f338d46d43d 100644
--- a/files-reg.c
+++ b/files-reg.c
@@ -173,7 +173,10 @@ static int open_remap_ghost(struct reg_file_info *rfi,
 	gf->dev = gfe->dev;
 	gf->ino = gfe->ino;
 
-	snprintf(gf->remap.path, PATH_MAX, "%s.cr.%x.ghost", rfi->path, rfe->remap_id);
+	if (S_ISDIR(gfe->mode))
+		strncpy(gf->remap.path, rfi->path, PATH_MAX);
+	else
+		snprintf(gf->remap.path, PATH_MAX, "%s.cr.%x.ghost", rfi->path, rfe->remap_id);
 
 	if (create_ghost(gf, gfe, root, img))
 		goto close_ifd;
-- 
1.9.3



More information about the CRIU mailing list