summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-16 14:56:11 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-26 06:59:41 +0000
commit609076d98b57018286be18f4efaf8955fa97c493 (patch)
tree973a9751a25e883c13aea47fc59f4c4919bd42a5 /util
parent381b7e3abb0dacf7ab6fc8103bcd221e9ecba027 (diff)
util/nvmutil: use local tmpfile on openbsd
if the global file is created on a different file system than the gbe file, unveil would trigger an abort trap, since we rely on created a second temporary file, whose path we can't know ahead of time. i could get rid of unveil, or unveil a directory, but neither is acceptable. just use localtmp on openbsd. a temporary file is created next to the gbe file, in the same directory. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util')
-rw-r--r--util/nvmutil/nvmutil.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index fbddcd3e..bab9ecfd 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -704,7 +704,17 @@ main(int argc, char *argv[])
fname = argv[1];
+#ifdef NVMUTIL_UNVEIL
+ /*
+ * if global tmp is a different filesystem,
+ * unveil would trap on final file rename
+ * and we can't know the path in advance
+ */
+ tname = new_tmpfile(&tmp_fd, 1, NULL);
+#else
tname = new_tmpfile(&tmp_fd, 0, NULL);
+#endif
+
if (tname == NULL)
err(errno, "Can't create tmpfile");