summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-10 16:52:38 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-10 16:52:38 +0000
commit9eb3895f4e514548830cf888a4c328c75d297a03 (patch)
tree048b619716cc67529c601f82ce4af86702ac7b5b
parent69cf4fe6eda9129a513e872bffa661d686e7cdec (diff)
util/nvmutil: tidy up gbe_cat_buf()
Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r--util/nvmutil/nvmutil.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index bcb0a2f8..304ed8ba 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -1134,29 +1134,25 @@ gbe_cat_buf(uint8_t *b)
rval = rw_file_exact(STDOUT_FILENO, b,
GBE_PART_SIZE, 0, SCHREIB);
- if (rval == -1) {
- if (errno == EAGAIN) {
- /*
- * We assume that no
- * data was written
- * to stdout.
- */
- errno = 0;
- continue;
- }
+ if (rval >= 0) {
+ /*
+ * A partial write is especially
+ * fatal, as it should already be
+ * prevented in rw_file_exact().
+ */
+ if ((size_t)rval != GBE_PART_SIZE)
+ err(EIO, "stdout: cat: Partial write");
+ break;
+ }
+ if (errno != EAGAIN)
err(errno, "stdout: cat");
- }
/*
- * A partial write is especially
- * fatal, as it should already be
- * prevented in rw_file_exact().
+ * We assume that no data
+ * was written to stdout.
*/
- if ((size_t)rval != GBE_PART_SIZE)
- err(EIO, "stdout: cat: Partial write");
-
- break;
+ errno = 0;
}
/*