2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 09:58:09 +00:00

mount: Fix trailing / when a file is bind-mounted

E.g. I have a /etc/hosts in workspace mounted from the host, and get the following message.

(00.141008)      1: mnt-v2: Create plain mountpoint /tmp/.criu.mntns.K1biY1/mnt-0000000938 for 938
(00.141546)      1: mnt-v2:     Mounting unsupported @938 (0)
(00.141887)      1: mnt-v2:     Bind /tmp/agent/1-d8c746c6fda3a8b2/workspace/etc/hosts/ to /tmp/.criu.mntns.K1biY1/mnt-0000000938
(00.142179)      1: Error (criu/mount-v2.c:319): mnt-v2: Failed to open_tree /tmp/agent/1-d8c746c6fda3a8b2/workspace/etc/hosts/: Not a directory
(00.143774) Error (criu/cr-restore.c:2320): Restoring FAILED.

Signed-off-by: Chuan Qiu <qiuc12@gmail.com>
This commit is contained in:
Chuan Qiu 2025-06-12 22:49:26 -07:00 committed by Andrei Vagin
parent b24f6e25bb
commit f8708ee4a0

View File

@ -888,7 +888,11 @@ static int resolve_external_mounts(struct mount_info *info)
cut_root = cut_root_for_bind(m->root, match->root);
if (cut_root[0] == '\0') {
p = xstrdup(match->ns_mountpoint + 1);
} else {
p = xsprintf("%s/%s", match->ns_mountpoint + 1, cut_root);
}
if (!p)
return -1;