util/nvmutil: split unveil handling

urandom in main. this is because i'm going to further
harden the use of pledge and unveil in a future patch,
and this is a prerequisite.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-02 16:34:59 +00:00
parent 896f0ea1df
commit e5d7c3e3a2
+1 -2
View File
@@ -89,6 +89,7 @@ main(int argc, char *argv[])
checkdir("/dev/urandom"); checkdir("/dev/urandom");
checkdir(fname); checkdir(fname);
#ifdef __OpenBSD__ #ifdef __OpenBSD__
err_if(unveil("/dev/urandom", "r") == -1);
block_unveil(); block_unveil();
#endif #endif
openFiles(fname); openFiles(fname);
@@ -446,8 +447,6 @@ swap(int partnum)
void void
block_unveil(void) block_unveil(void)
{ {
err_if(unveil("/dev/urandom", "r") == -1);
if (flags == O_RDONLY) { if (flags == O_RDONLY) {
err_if(unveil(fname, "r") == -1); err_if(unveil(fname, "r") == -1);
err_if(unveil(NULL, NULL) == -1); err_if(unveil(NULL, NULL) == -1);