From e3e02fa65735c7eee77bf5c339af075fe85b8609 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 10 Mar 2026 10:53:11 +0000 Subject: util/nvmutil: restore errno on failed offset restore Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'util/nvmutil/nvmutil.c') diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 16dabedc..76cf23ca 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -1390,8 +1390,11 @@ prw(int fd, void *mem, size_t count, if (r < 0) saved_errno = errno; - if (lseek_eintr(fd, old, SEEK_SET) == (off_t)-1) + if (lseek_eintr(fd, old, SEEK_SET) == (off_t)-1) { + if (saved_errno) + errno = saved_errno; return -1; + } if (r < 0) errno = saved_errno; -- cgit v1.2.1