syscalls: fix dirfd_enter

This commit is contained in:
Matheus
2026-03-20 21:30:29 -03:00
parent f8694029ab
commit a777c0ee06
+7 -7
View File
@@ -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;
} }