mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 22:05:36 +00:00
Fix AUFS pathname handling when branch is not exposed
The code that fixes up AUFS pathnames associated with vma entries (see
commit d8b41b6525
) should handle cases where an entry does not expose
the branch pathname (e.g., pointing to a device like /dev/zero).
Signed-off-by: Saied Kazemi <saied@google.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
7b4a264e28
commit
490ca71866
@@ -272,6 +272,7 @@ err:
|
||||
*/
|
||||
int fixup_aufs_vma_fd(struct vma_area *vma)
|
||||
{
|
||||
char *file;
|
||||
char path[PATH_MAX];
|
||||
int len;
|
||||
|
||||
@@ -284,7 +285,15 @@ int fixup_aufs_vma_fd(struct vma_area *vma)
|
||||
if (len < 0)
|
||||
return -1;
|
||||
|
||||
if (len > 0) {
|
||||
if (len == 0) {
|
||||
/*
|
||||
* The vma is associated with a map_files entry
|
||||
* that does not expose the branch pathname
|
||||
* (e.g., /dev/zero). In this case, we can use
|
||||
* the path.
|
||||
*/
|
||||
file = &path[1];
|
||||
} else {
|
||||
vma->aufs_rpath = xmalloc(len + 2);
|
||||
if (!vma->aufs_rpath)
|
||||
return -1;
|
||||
@@ -297,9 +306,10 @@ int fixup_aufs_vma_fd(struct vma_area *vma)
|
||||
sprintf(vma->aufs_fpath, "%s/%s", opts.root, &path[2]);
|
||||
}
|
||||
pr_debug("Saved AUFS paths %s and %s\n", vma->aufs_rpath, vma->aufs_fpath);
|
||||
file = vma->aufs_fpath;
|
||||
}
|
||||
|
||||
if (stat(vma->aufs_fpath, vma->vmst) < 0) {
|
||||
if (stat(file, vma->vmst) < 0) {
|
||||
pr_perror("Failed stat on map %"PRIx64" (%s)",
|
||||
vma->e->start, vma->aufs_fpath);
|
||||
return -1;
|
||||
|
Reference in New Issue
Block a user