util/nvmutil: bring pledge in set_io_flag to main

in general, we should ensure that the pledge calls only happen
inside main. this means we can more easily see them, in future
re-factoring.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-02 16:57:50 +00:00
parent 46b6b1feb3
commit ea1a9bc786
+4 -4
View File
@@ -87,6 +87,10 @@ main(int argc, char *argv[])
fname = argv[1];
set_io_flags(argc, argv);
#ifdef __OpenBSD__
if (flags == O_RDONLY)
err_if(pledge("stdio rpath unveil", NULL) == -1);
#endif
checkdir("/dev/urandom");
checkdir(fname);
#ifdef __OpenBSD__
@@ -148,10 +152,6 @@ set_io_flags(int argc, char *argv[])
if (argc > 2)
if (strcmp(COMMAND, "dump") == 0)
flags = O_RDONLY;
#ifdef __OpenBSD__
if (flags == O_RDONLY)
err_if(pledge("stdio rpath unveil", NULL) == -1);
#endif
}
void