Commit 490ca718 authored by Saied Kazemi's avatar Saied Kazemi Committed by Pavel Emelyanov

Fix AUFS pathname handling when branch is not exposed

The code that fixes up AUFS pathnames associated with vma entries (see
commit d8b41b65) should handle cases where an entry does not expose
the branch pathname (e.g., pointing to a device like /dev/zero).
Signed-off-by: 's avatarSaied Kazemi <saied@google.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 7b4a264e
......@@ -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;
......
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