diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-03 20:13:31 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-03 20:15:39 +0000 |
| commit | 80a5b080909a7706b57ba01516a1de681366fbeb (patch) | |
| tree | b8a2dddc8b92ece0b896d6fc408c5aa80aa1fad4 /util | |
| parent | 3f7d89c4012144c0a04f01f535c0fbbc9cfabcb3 (diff) | |
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>
Diffstat (limited to 'util')
| -rw-r--r-- | util/nvmutil/nvmutil.c | 7 |
1 files changed, 6 insertions, 1 deletions
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; } |
