mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 23:18:21 +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) {
|
} else if (dirfd == AT_FDCWD) {
|
||||||
*dirnode = proc_get_cwd();
|
*dirnode = proc_get_cwd();
|
||||||
} else {
|
} else {
|
||||||
*file = fd_get(dirfd);
|
file_t *f = fd_get(dirfd);
|
||||||
if (file == NULL) {
|
if (f == NULL)
|
||||||
return EBADF;
|
return EBADF;
|
||||||
}
|
|
||||||
|
|
||||||
*dirnode = (*file)->vnode;
|
if (f->vnode->type != V_TYPE_DIR) {
|
||||||
|
fd_release(f);
|
||||||
if ((*dirnode)->type != V_TYPE_DIR) {
|
|
||||||
fd_release(*file);
|
|
||||||
return ENOTDIR;
|
return ENOTDIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*file = f;
|
||||||
|
*dirnode = f->vnode;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user