summaryrefslogtreecommitdiff
path: root/util/libreboot-utils/lib/io.c
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-04-01 16:11:50 +0100
committerLeah Rowe <leah@libreboot.org>2026-04-01 16:19:46 +0100
commitf68cedf202c1fc6c39243136a4d766bc1d67cc80 (patch)
treed9b2bccaaa19437aafe4e95ed56bfdebf2730b98 /util/libreboot-utils/lib/io.c
parent5b465d3af6d61c3a1dc69d727948bef470b7be46 (diff)
libreboot-utils/file: never retry file rw on zero
even with a timer, it's possible that on a buggy system, we may keep writing even though the outcome is zero. if a system comes back with zero bytes written, that is a fatal bug and we should stop. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/libreboot-utils/lib/io.c')
-rw-r--r--util/libreboot-utils/lib/io.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/util/libreboot-utils/lib/io.c b/util/libreboot-utils/lib/io.c
index f8e67977..81f9f52a 100644
--- a/util/libreboot-utils/lib/io.c
+++ b/util/libreboot-utils/lib/io.c
@@ -109,7 +109,7 @@ read_file(void)
/* read main file
*/
_r = rw_file_exact(f->gbe_fd, f->buf, f->gbe_file_size,
- 0, IO_PREAD, MAX_ZERO_RW_RETRY);
+ 0, IO_PREAD);
if (_r < 0)
exitf("%s: read failed", f->fname);
@@ -117,7 +117,7 @@ read_file(void)
/* copy to tmpfile
*/
_r = rw_file_exact(f->tmp_fd, f->buf, f->gbe_file_size,
- 0, IO_PWRITE, MAX_ZERO_RW_RETRY);
+ 0, IO_PWRITE);
if (_r < 0)
exitf("%s: %s: copy failed",
@@ -140,7 +140,7 @@ read_file(void)
exitf("%s: fsync (tmpfile copy)", f->tname);
_r = rw_file_exact(f->tmp_fd, f->bufcmp, f->gbe_file_size,
- 0, IO_PREAD, MAX_ZERO_RW_RETRY);
+ 0, IO_PREAD);
if (_r < 0)
exitf("%s: read failed (cmp)", f->tname);
@@ -556,8 +556,7 @@ rw_gbe_file_exact(int fd, unsigned char *mem, size_t nrw,
if (nrw > (size_t)GBE_PART_SIZE)
goto err_rw_gbe_file_exact;
- r = rw_file_exact(fd, mem, nrw, off, rw_type,
- MAX_ZERO_RW_RETRY);
+ r = rw_file_exact(fd, mem, nrw, off, rw_type);
return rw_over_nrw(r, nrw);