util/nvmutil: restore errno on failed offset restore

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-10 10:53:11 +00:00
parent 6408570fa1
commit e3e02fa657
+4 -1
View File
@@ -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;