diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-10 10:24:16 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-10 10:24:16 +0000 |
| commit | 5a005eff9e404873876ec676917f55f27333ddf5 (patch) | |
| tree | 225abd51da99150b67418953179f26f36df36d82 | |
| parent | 890d1a2ff603a1717498ba3d6a74f1c0f27c2415 (diff) | |
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>
| -rw-r--r-- | util/nvmutil/nvmutil.c | 6 |
1 files changed, 2 insertions, 4 deletions
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; } |
