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
This commit is contained in:
Axel Dörfler 2005-04-05 01:09:07 +00:00
parent 1bd7e1b36c
commit 7f915be3c3
1 changed files with 5 additions and 4 deletions

View File

@ -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);
}