From 7f915be3c32ddc889c2ae5e95c1a28596feb1bc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 5 Apr 2005 01:09:07 +0000 Subject: [PATCH] Fixed _kern_set_cwd() and _user_set_cwd() - they did not properly handle cases with fd and path at the same time. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12244 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/core/fs/vfs.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/kernel/core/fs/vfs.cpp b/src/kernel/core/fs/vfs.cpp index a8525fb375..b31c6f43de 100644 --- a/src/kernel/core/fs/vfs.cpp +++ b/src/kernel/core/fs/vfs.cpp @@ -3766,6 +3766,7 @@ common_read_stat(struct file_descriptor *descriptor, struct stat *stat) struct vnode *vnode = descriptor->u.vnode; FUNCTION(("common_read_stat: stat %p\n", stat)); + status_t status = FS_CALL(vnode, read_stat)(vnode->mount->cookie, vnode->private_node, stat); @@ -5646,10 +5647,10 @@ _kern_setcwd(int fd, const char *path) { char pathBuffer[B_PATH_NAME_LENGTH + 1]; - if (fd == -1) + if (path != NULL) strlcpy(pathBuffer, path, B_PATH_NAME_LENGTH); - return set_cwd(fd, pathBuffer, true); + return set_cwd(fd, path != NULL ? pathBuffer : NULL, true); } @@ -6515,13 +6516,13 @@ _user_setcwd(int fd, const char *userPath) PRINT(("user_setcwd: path = %p\n", userPath)); - if (fd == -1) { + if (userPath != NULL) { if (!IS_USER_ADDRESS(userPath) || user_strlcpy(path, userPath, B_PATH_NAME_LENGTH) < B_OK) return B_BAD_ADDRESS; } - return set_cwd(fd, path, false); + return set_cwd(fd, userPath != NULL ? path : NULL, false); }