mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
syscalls: fix dirfd_enter
This commit is contained in:
@@ -19,17 +19,17 @@ static inline int dirfd_enter(char *path, int dirfd, file_t **file, vnode_t **di
|
||||
} else if (dirfd == AT_FDCWD) {
|
||||
*dirnode = proc_get_cwd();
|
||||
} else {
|
||||
*file = fd_get(dirfd);
|
||||
if (file == NULL) {
|
||||
file_t *f = fd_get(dirfd);
|
||||
if (f == NULL)
|
||||
return EBADF;
|
||||
}
|
||||
|
||||
*dirnode = (*file)->vnode;
|
||||
|
||||
if ((*dirnode)->type != V_TYPE_DIR) {
|
||||
fd_release(*file);
|
||||
if (f->vnode->type != V_TYPE_DIR) {
|
||||
fd_release(f);
|
||||
return ENOTDIR;
|
||||
}
|
||||
|
||||
*file = f;
|
||||
*dirnode = f->vnode;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user