From d6601059fbe8d00065bf0e4fffeaf597642469ca Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 4 Mar 2026 01:43:39 +0000 Subject: util/nvmutil: reset errno on *successful* read otherwise, stale errno from an earlier syscall might cause a valid read to still fail. Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'util') diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 749ed0bc..6ed6d946 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -436,8 +436,10 @@ static int check_read_or_die(const char *rpath, ssize_t rval, size_t rsize, int retry, const char *readtype) { - if (rval == (ssize_t) rsize) + if (rval == (ssize_t) rsize) { + errno = 0; return 1; /* Successful read */ + } if (rval != -1) err(ECANCELED, "Short %s, %zd bytes, on file: %s", -- cgit v1.2.1