summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-15 00:13:45 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-15 00:13:45 +0000
commitd64d7878e46d498edc1945ce0ab8eb85bb24987e (patch)
treea605244c4df41da1609693d815ca496186868d70
parent2bb67c9cd50d8301a9ed140da300ba28a5cf4b56 (diff)
util/nvmutil: stricter lseep_loop return offset
we currently reset just fine, but a partial success where the previous offset is not the same as the original should also be considered failure. this patch therefore makes the return much stricter, making the code return an error if this occurs, which in nvmutil would then cause a program exit. Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r--util/nvmutil/nvmutil.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index de14461f..690cf497 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -2107,14 +2107,15 @@ real_pread_pwrite:
}
saved_errno = errno;
+
off_last = lseek_loop(fd, off_orig, SEEK_SET,
loop_eagain, loop_eintr);
- if (off_last == (off_t)-1) {
+
+ if (off_last != off_orig) {
errno = saved_errno;
- return -1;
- }
- if (off_last != off_orig)
goto err_prw;
+ }
+
errno = saved_errno;
return rw_over_nrw(r, nrw);