From: Andrei Tatar Date: Tue, 18 Mar 2025 16:37:54 +0000 (+0100) Subject: lib/posix-fdio: Fix lseek error on readonly files X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=e6edc8e15036dca32a81dd4b93572c6cdaebf87d;p=unikraft%2Funikraft.git 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 --- 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;