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-26 06:59:41 +0000
commit2c66b813ef18bf8e31bc15dc7023b843a710e080 (patch)
tree7ad71c359dc9e2464e8bbf7361369cdc9931a487
parent00f92b33e1c4fb377cef36c2ecc51b397561aae4 (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);