From 5a005eff9e404873876ec676917f55f27333ddf5 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 10 Mar 2026 10:24:16 +0000 Subject: util/nvmutil prw: always restore original offset it currently only does so on success, but errors will leave the file descriptor corrupted. reset it accordingly. Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'util') diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index ac94e690..2bc74615 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -1388,10 +1388,8 @@ prw(int fd, void *mem, size_t count, err(EIO, "%s: Invalid rw_type", path); } while (r < 0 && errno == EINTR); - if (r >= 0) { - if (lseek_eintr(fd, old, SEEK_SET) == (off_t)-1) - return -1; - } + if (lseek_eintr(fd, old, SEEK_SET) == (off_t)-1) + return -1; return r; } -- cgit v1.2.1