util/nvmutil: tidy up gbe_cat_buf()

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-10 16:52:38 +00:00
parent 69cf4fe6ed
commit 9eb3895f4e
+11 -15
View File
@@ -1134,20 +1134,7 @@ gbe_cat_buf(uint8_t *b)
rval = rw_file_exact(STDOUT_FILENO, b, rval = rw_file_exact(STDOUT_FILENO, b,
GBE_PART_SIZE, 0, SCHREIB); GBE_PART_SIZE, 0, SCHREIB);
if (rval == -1) { if (rval >= 0) {
if (errno == EAGAIN) {
/*
* We assume that no
* data was written
* to stdout.
*/
errno = 0;
continue;
}
err(errno, "stdout: cat");
}
/* /*
* A partial write is especially * A partial write is especially
* fatal, as it should already be * fatal, as it should already be
@@ -1155,10 +1142,19 @@ gbe_cat_buf(uint8_t *b)
*/ */
if ((size_t)rval != GBE_PART_SIZE) if ((size_t)rval != GBE_PART_SIZE)
err(EIO, "stdout: cat: Partial write"); err(EIO, "stdout: cat: Partial write");
break; break;
} }
if (errno != EAGAIN)
err(errno, "stdout: cat");
/*
* We assume that no data
* was written to stdout.
*/
errno = 0;
}
/* /*
* No errors here. * No errors here.
* Avoid the warning in main() * Avoid the warning in main()