From 15b37b2a1ab286c550a43276f238a09766e12049 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 31 Dec 2024 21:14:24 +0000 Subject: 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 --- util/nvmutil/nvmutil.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'util/nvmutil') diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 35abbfae..c7de5e0f 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -77,8 +77,11 @@ main(int argc, char *argv[]) #ifdef __OpenBSD__ err_if(unveil("/dev/urandom", "r") == -1); err_if(unveil(filename, flags == O_RDONLY ? "r" : "rw") == -1); - err_if(pledge(flags == O_RDONLY ? "stdio rpath" : "stdio rpath wpath", - NULL) == -1); + if (flags == O_RDONLY) { + err_if(pledge("stdio rpath", NULL) == -1); + } else { + err_if(pledge("stdio rpath wpath", NULL) == -1); + } #endif openFiles(filename); #ifdef __OpenBSD__ -- cgit v1.2.1