diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-10 16:52:38 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-10 16:52:38 +0000 |
| commit | 9eb3895f4e514548830cf888a4c328c75d297a03 (patch) | |
| tree | 048b619716cc67529c601f82ce4af86702ac7b5b /util/nvmutil | |
| parent | 69cf4fe6eda9129a513e872bffa661d686e7cdec (diff) | |
util/nvmutil: tidy up gbe_cat_buf()
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/nvmutil')
| -rw-r--r-- | util/nvmutil/nvmutil.c | 32 |
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; } /* |
