Compare commits

...

4 Commits

Author SHA1 Message Date
Leah Rowe
e2d8734150 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>
2026-03-16 15:00:08 +00:00
Leah Rowe
a74f184437 util/nvmutil: /dev/random fallback
now the custom fallback code is very unlikely
to ever actually be used, on any system,
except really old systems.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-03-16 14:47:55 +00:00
Leah Rowe
975aefeb80 add -I. to nvmutil makefile
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-03-15 23:28:44 +00:00
Leah Rowe
68b6851075 re-add strict flags
i need these. can always turn them off
when running make if you need to

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-03-15 23:28:02 +00:00
2 changed files with 15 additions and 3 deletions

View File

@@ -4,10 +4,10 @@
CC?=cc
CSTD?=-std=c90
WERROR?=
CWARN?=-Wall -pedantic
WERROR?=-Werror
CWARN?=-Wall -Wextra -pedantic
COPT?=-Os
CFLAGS?=$(COPT) $(CWARN) $(CSTD)
CFLAGS?=-I. $(COPT) $(CWARN) $(CSTD)
LDFLAGS?=
DESTDIR?=
PREFIX?=/usr/local

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");
@@ -1373,6 +1383,8 @@ read_urandom(void)
if (fd < 0) {
fd = open("/dev/urandom", O_RDONLY);
if (fd < 0)
fd = open("/dev/random", O_RDONLY);
if (fd < 0)
return 16;