using chroot with a mount point wrongly exposed the mount point name: we now avoid resolving the volume root in case we hit the IO context root.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33645 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -2640,22 +2640,24 @@ dir_vnode_to_path(struct vnode* vnode, char* buffer, size_t bufferSize,
|
|||||||
int32 maxLevel = 256;
|
int32 maxLevel = 256;
|
||||||
int32 length;
|
int32 length;
|
||||||
status_t status;
|
status_t status;
|
||||||
|
struct io_context* ioContext = get_current_io_context(kernel);
|
||||||
|
|
||||||
// we don't use get_vnode() here because this call is more
|
// we don't use get_vnode() here because this call is more
|
||||||
// efficient and does all we need from get_vnode()
|
// efficient and does all we need from get_vnode()
|
||||||
inc_vnode_ref_count(vnode);
|
inc_vnode_ref_count(vnode);
|
||||||
|
|
||||||
// resolve a volume root to its mount point
|
if (vnode != ioContext->root) {
|
||||||
struct vnode* mountPoint = resolve_volume_root_to_mount_point(vnode);
|
// we don't hit the IO context root
|
||||||
if (mountPoint) {
|
// resolve a volume root to its mount point
|
||||||
put_vnode(vnode);
|
struct vnode* mountPoint = resolve_volume_root_to_mount_point(vnode);
|
||||||
vnode = mountPoint;
|
if (mountPoint) {
|
||||||
|
put_vnode(vnode);
|
||||||
|
vnode = mountPoint;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
path[--insert] = '\0';
|
path[--insert] = '\0';
|
||||||
|
|
||||||
struct io_context* ioContext = get_current_io_context(kernel);
|
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
// the name buffer is also used for fs_read_dir()
|
// the name buffer is also used for fs_read_dir()
|
||||||
char nameBuffer[sizeof(struct dirent) + B_FILE_NAME_LENGTH];
|
char nameBuffer[sizeof(struct dirent) + B_FILE_NAME_LENGTH];
|
||||||
@@ -2678,12 +2680,16 @@ dir_vnode_to_path(struct vnode* vnode, char* buffer, size_t bufferSize,
|
|||||||
status = get_vnode_name(vnode, parentVnode, (struct dirent*)nameBuffer,
|
status = get_vnode_name(vnode, parentVnode, (struct dirent*)nameBuffer,
|
||||||
sizeof(nameBuffer), ioContext);
|
sizeof(nameBuffer), ioContext);
|
||||||
|
|
||||||
// resolve a volume root to its mount point
|
if (vnode != ioContext->root) {
|
||||||
mountPoint = resolve_volume_root_to_mount_point(parentVnode);
|
// we don't hit the IO context root
|
||||||
if (mountPoint) {
|
// resolve a volume root to its mount point
|
||||||
put_vnode(parentVnode);
|
struct vnode* mountPoint
|
||||||
parentVnode = mountPoint;
|
= resolve_volume_root_to_mount_point(parentVnode);
|
||||||
parentID = parentVnode->id;
|
if (mountPoint) {
|
||||||
|
put_vnode(parentVnode);
|
||||||
|
parentVnode = mountPoint;
|
||||||
|
parentID = parentVnode->id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hitRoot = (parentVnode == vnode);
|
bool hitRoot = (parentVnode == vnode);
|
||||||
|
|||||||
Reference in New Issue
Block a user