get_vnode_name():
* read_dir() is supposed to return B_OK and and a count of 0 when reaching the end of the directory. In case the node in question could not be found, we were looping infinitely. * free_dir_cookie() was not invoked. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20519 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1852,13 +1852,21 @@ get_vnode_name(struct vnode *vnode, struct vnode *parent, struct dirent *buffer,
|
|||||||
status = dir_read(parent, cookie, buffer, bufferSize, &num);
|
status = dir_read(parent, cookie, buffer, bufferSize, &num);
|
||||||
if (status < B_OK)
|
if (status < B_OK)
|
||||||
break;
|
break;
|
||||||
|
if (num == 0) {
|
||||||
|
status = B_ENTRY_NOT_FOUND;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (vnode->id == buffer->d_ino) {
|
if (vnode->id == buffer->d_ino) {
|
||||||
// found correct entry!
|
// found correct entry!
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FS_CALL(vnode, close_dir)(vnode->mount->cookie, vnode->private_node, cookie);
|
|
||||||
|
FS_CALL(vnode, close_dir)(vnode->mount->cookie, vnode->private_node,
|
||||||
|
cookie);
|
||||||
|
FS_CALL(vnode, free_dir_cookie)(vnode->mount->cookie,
|
||||||
|
vnode->private_node, cookie);
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user