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:
Ingo Weinhold 2007-04-03 04:29:24 +00:00
parent 6a83347f52
commit 1e768ed1d3

View File

@ -1852,13 +1852,21 @@ get_vnode_name(struct vnode *vnode, struct vnode *parent, struct dirent *buffer,
status = dir_read(parent, cookie, buffer, bufferSize, &num);
if (status < B_OK)
break;
if (num == 0) {
status = B_ENTRY_NOT_FOUND;
break;
}
if (vnode->id == buffer->d_ino) {
// found correct entry!
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;
}