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>
This commit is contained in:
Leah Rowe
2026-03-15 00:13:45 +00:00
parent 00f92b33e1
commit 2c66b813ef
+5 -4
View File
@@ -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);