From 80a5b080909a7706b57ba01516a1de681366fbeb Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 3 Mar 2026 20:13:31 +0000 Subject: util/nvmutil: set errno only if x is not 0 otherwise, some minor edge cases may result in err printing "success", when we want to signal an error. Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'util/nvmutil') diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 30a2b57c..1c044a19 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -627,5 +627,10 @@ getnvmprogname(void) static void set_err(int x) { - errno = errno ? errno : x; + if (errno) + return; + if (x) + errno = x; /* TODO: check x against system errno values */ + else + errno = ECANCELED; } -- cgit v1.2.1