Commit 813665f7 authored by Andrew Vagin's avatar Andrew Vagin Committed by Pavel Emelyanov

ghost: add / between an mntns root and a file path

(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: 's avatarAdrian Reber <adrian@lisas.de>
Cc: Adrian Reber <adrian@lisas.de>
Signed-off-by: 's avatarAndrew Vagin <avagin@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent cf292404
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment