mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 15:08:21 +00:00
getdent: make sure fd is readable
This commit is contained in:
@@ -23,7 +23,7 @@ syscallret_t syscall_getdents(context_t *, int dirfd, void *ubuffer, size_t read
|
|||||||
}
|
}
|
||||||
|
|
||||||
file_t *fd = fd_get(dirfd);
|
file_t *fd = fd_get(dirfd);
|
||||||
if (fd == NULL) {
|
if (fd == NULL || (fd->flags & FILE_READ) == 0) {
|
||||||
free(buffer);
|
free(buffer);
|
||||||
ret.errno = EBADF;
|
ret.errno = EBADF;
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
Reference in New Issue
Block a user