From 8657d084d2ae61a4cb06b5bc63223a92bfb5beb0 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 29 Mar 2026 14:37:51 +0100 Subject: util/nvmutil: re-add cleanup delete tmpfiles after operation. fixes a bug where tmpfiles are left behind after running the dump command. Signed-off-by: Leah Rowe --- util/libreboot-utils/nvmutil.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'util/libreboot-utils') diff --git a/util/libreboot-utils/nvmutil.c b/util/libreboot-utils/nvmutil.c index 8d1b866c..ec41371f 100644 --- a/util/libreboot-utils/nvmutil.c +++ b/util/libreboot-utils/nvmutil.c @@ -95,5 +95,22 @@ main(int argc, char *argv[]) static void exit_cleanup(void) { - return; + struct xstate *x; + struct xfile *f; + + x = xstatus(); + if (x == NULL) + return; + + f = &x->f; + + /* close fds if still open */ + close_on_eintr(&f->tmp_fd); + close_on_eintr(&f->gbe_fd); + + /* unlink tmpfile if it exists */ + if (f->tname != NULL) { + (void) unlink(f->tname); + free_and_set_null(&f->tname); + } } -- cgit v1.2.1