diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-02 16:57:50 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-02 16:57:50 +0000 |
| commit | ea1a9bc786133336d63b3da7e98896b575ad435f (patch) | |
| tree | f438d54f0f3789583278ca18bdecb32e60b1336f /util/nvmutil | |
| parent | 46b6b1feb3a5c5d325010e768cdd5af4dd82cb2a (diff) | |
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>
Diffstat (limited to 'util/nvmutil')
| -rw-r--r-- | util/nvmutil/nvmutil.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 27c50bf5..153ac2be 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -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 |
