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 <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-03 20:13:31 +00:00
parent 3f7d89c401
commit 80a5b08090
+6 -1
View File
@@ -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;
}