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 <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-10 10:24:16 +00:00
parent 890d1a2ff6
commit 5a005eff9e
+2 -4
View File
@@ -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;
}