getdent: make sure fd is readable

This commit is contained in:
Matheus
2024-08-24 22:33:58 -03:00
parent 4308317ea5
commit 807c27e7f5
+1 -1
View File
@@ -23,7 +23,7 @@ syscallret_t syscall_getdents(context_t *, int dirfd, void *ubuffer, size_t read
}
file_t *fd = fd_get(dirfd);
if (fd == NULL) {
if (fd == NULL || (fd->flags & FILE_READ) == 0) {
free(buffer);
ret.errno = EBADF;
return ret;