From 3dedbea70dfcc392b6a596370e598aca5e4fbde0 Mon Sep 17 00:00:00 2001 From: Lephe Date: Sun, 6 Apr 2025 15:54:22 +0200 Subject: [PATCH] fs: fix incorrect cursor state after pread/pwrite --- src/fs/pread.c | 2 +- src/fs/pwrite.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fs/pread.c b/src/fs/pread.c index d06f777..4d519f1 100644 --- a/src/fs/pread.c +++ b/src/fs/pread.c @@ -19,6 +19,6 @@ ssize_t pread(int fd, void *buf, size_t size, off_t offset) end: /* At the end, always try to restore the current position */ - lseek(fd, current, SEEK_CUR); + lseek(fd, current, SEEK_SET); return rc; } diff --git a/src/fs/pwrite.c b/src/fs/pwrite.c index 10b8ff7..b42ff5c 100644 --- a/src/fs/pwrite.c +++ b/src/fs/pwrite.c @@ -17,6 +17,6 @@ ssize_t pwrite(int fd, const void *buf, size_t size, off_t offset) end: /* At the end, always try to restore the current position */ - lseek(fd, current, SEEK_CUR); + lseek(fd, current, SEEK_SET); return rc; }