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>
This commit is contained in:
Leah Rowe
2026-03-16 14:56:11 +00:00
parent a74f184437
commit e2d8734150

View File

@@ -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");