]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
lib/posix-fdio: Fix lseek error on readonly files
authorAndrei Tatar <andrei@unikraft.io>
Tue, 18 Mar 2025 16:37:54 +0000 (17:37 +0100)
committerUnikraft Bot <monkey@unikraft.io>
Thu, 27 Mar 2025 17:23:26 +0000 (17:23 +0000)
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 <andrei@unikraft.io>
Approved-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
GitHub-Closes: #1602

lib/posix-fdio/fdio.c

index dc8b2a6736410f28305856780ac3308647d0f4ad..0d4b50b5cc514fcefe72b0280a1ccedec14b74e2 100644 (file)
@@ -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;