util/nvmutil: Tidy up pledge calls

I wasn't too happy using shorthand for strings like that.

Tidy it up and use good old fashioned if/else.

Signed-off-by: Leah Rowe <leah@libreboot.org>
master
Leah Rowe 2024-12-31 21:14:24 +00:00
parent e8799310db
commit 15b37b2a1a
1 changed files with 5 additions and 2 deletions

View File

@ -77,8 +77,11 @@ main(int argc, char *argv[])
#ifdef __OpenBSD__ #ifdef __OpenBSD__
err_if(unveil("/dev/urandom", "r") == -1); err_if(unveil("/dev/urandom", "r") == -1);
err_if(unveil(filename, flags == O_RDONLY ? "r" : "rw") == -1); err_if(unveil(filename, flags == O_RDONLY ? "r" : "rw") == -1);
err_if(pledge(flags == O_RDONLY ? "stdio rpath" : "stdio rpath wpath", if (flags == O_RDONLY) {
NULL) == -1); err_if(pledge("stdio rpath", NULL) == -1);
} else {
err_if(pledge("stdio rpath wpath", NULL) == -1);
}
#endif #endif
openFiles(filename); openFiles(filename);
#ifdef __OpenBSD__ #ifdef __OpenBSD__