summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-29 14:37:51 +0100
committerLeah Rowe <leah@libreboot.org>2026-03-29 14:37:51 +0100
commit8657d084d2ae61a4cb06b5bc63223a92bfb5beb0 (patch)
treeb7bfac44fde5ad7f8702b274150551a93b01bc7f /util
parente4016eb32c6fce3b3507de16961e8d60907f6776 (diff)
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 <leah@libreboot.org>
Diffstat (limited to 'util')
-rw-r--r--util/libreboot-utils/nvmutil.c19
1 files changed, 18 insertions, 1 deletions
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);
+ }
}