From b5054f68bae37facdc839c7f616939736847f3cc Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 8 Mar 2026 15:07:29 +0000 Subject: util/nvmutil: don't write gbe file if errno set nice bit of defense here we absolutely need this code to be bullet proof Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'util/nvmutil/nvmutil.c') diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index cd3d3650..9d2c50c9 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -292,7 +292,11 @@ main(int argc, char *argv[]) read_gbe_file(); run_cmd(cmd_index); - write_gbe_file(); + + if (errno) + err(errno, "Unhandled error: will not write file: %s", fname); + else + write_gbe_file(); if (close(gbe_fd) == -1) err(ECANCELED, "close '%s'", fname); -- cgit v1.2.1