[CRIU] [PATCH 1/5] ghost: add / between an mntns root and a file path
Andrey Vagin
avagin at openvz.org
Wed May 11 13:37:03 PDT 2016
From: Andrew Vagin <avagin at virtuozzo.com>
(00.170031) Error (files-reg.c:515): `- XFail [.criu.mntns.3xE0jR/15var/tmp/ibmiNsaA.cr.5.ghost] ghost: No such file or directory
Reported-by: Adrian Reber <adrian at lisas.de>
Cc: Adrian Reber <adrian at lisas.de>
Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
criu/files-reg.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/criu/files-reg.c b/criu/files-reg.c
index fd36ae9..ce9373d 100644
--- a/criu/files-reg.c
+++ b/criu/files-reg.c
@@ -495,17 +495,25 @@ static void try_clean_ghost(struct remap_info *ri)
ret = rst_get_mnt_root(mnt_id, path, sizeof(path));
if (ret < 0)
return;
+ if (ret >= sizeof(path) - 1) {
+ pr_err("The path buffer is too small\n");
+ return;
+ }
+ if (path[ret] != '/') {
+ path[ret++] = '/';
+ path[ret] = 0;
+ }
if (ri->rfi->remap == NULL)
return;
if (!ri->rfi->is_dir) {
- ghost_path(path + ret, sizeof(path) - 1, ri->rfi, ri->rfe);
+ ghost_path(path + ret, sizeof(path) - ret, ri->rfi, ri->rfe);
if (!unlink(path)) {
pr_info(" `- X [%s] ghost\n", path);
return;
}
} else {
- strncpy(path + ret, ri->rfi->path, sizeof(path) - 1);
+ strncpy(path + ret, ri->rfi->path, sizeof(path) - ret);
if (!rmdir(path)) {
pr_info(" `- Xd [%s] ghost\n", path);
return;
--
2.7.4
More information about the CRIU
mailing list