From 9eb3895f4e514548830cf888a4c328c75d297a03 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 10 Mar 2026 16:52:38 +0000 Subject: util/nvmutil: tidy up gbe_cat_buf() Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 32 ++++++++++++++------------------ 1 file 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; } /* -- cgit v1.2.1