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-16 15:00:08 +0000
commite2d873415083fbddb965bece133090628cbab772 (patch)
tree4b6303b5afa92d4d1e406f833e0e2ac17ed5ff6d /util
parenta74f184437d5fa7354a36344db9eb994a277f4af (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");