From 70cdc7af6094ced189618e3d4790cdf8e4060b45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 16 May 2004 11:55:42 +0000 Subject: [PATCH] If you call get_fd_and_vnode() you need to free it with put_fd(), not put_vnode() - thanks to Ingo for pointing this out. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7597 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/core/fs/vfs.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/kernel/core/fs/vfs.cpp b/src/kernel/core/fs/vfs.cpp index 0efe6c0229..5f51a7313f 100755 --- a/src/kernel/core/fs/vfs.cpp +++ b/src/kernel/core/fs/vfs.cpp @@ -1143,6 +1143,9 @@ get_fd_and_vnode(int fd, struct vnode **_vnode, bool kernel) return NULL; } + // ToDo: when we can close a file descriptor at any point, investigate + // if this is still valid to do (accessing the vnode without ref_count + // or locking) *_vnode = descriptor->u.vnode; return descriptor; } @@ -2886,7 +2889,7 @@ attr_remove(int fd, const char *name, bool kernel) else status = EROFS; - put_vnode(vnode); + put_fd(fd); return status; } @@ -2926,9 +2929,9 @@ attr_rename(int fromfd, const char *fromName, int tofd, const char *toName, bool status = EROFS; err1: - put_vnode(toVnode); + put_fd(tofd); err: - put_vnode(fromVnode); + put_fd(fromfd); return status; }