From e6edc8e15036dca32a81dd4b93572c6cdaebf87d Mon Sep 17 00:00:00 2001 From: Andrei Tatar Date: Tue, 18 Mar 2025 17:37:54 +0100 Subject: [PATCH] lib/posix-fdio: Fix lseek error on readonly files Previously lseek would wrongly fail when seeking a read-only-opened file due to a logic error. This change fixes this oversight. Signed-off-by: Andrei Tatar Approved-by: Sergiu Moga Reviewed-by: Sergiu Moga GitHub-Closes: #1602 --- lib/posix-fdio/fdio.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/posix-fdio/fdio.c b/lib/posix-fdio/fdio.c index dc8b2a673..0d4b50b5c 100644 --- a/lib/posix-fdio/fdio.c +++ b/lib/posix-fdio/fdio.c @@ -409,8 +409,6 @@ off_t uk_sys_lseek(struct uk_ofile *of, off_t offset, int whence) mode = of->mode; - if (unlikely(!_CAN_WRITE(mode))) - return -EINVAL; if (unlikely(!_IS_SEEKABLE(mode))) return -ESPIPE; -- 2.39.5