From 57971ceb227f45f8568a15a46bdee789eff20cf5 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 1 Jan 2025 14:48:29 +0000 Subject: util/nvmutil: Fix another straggler I don't like using strings this way, it looks unclean. Once again, use good old fashioned if/else. Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'util/nvmutil') diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index c7de5e0f..7f6b8782 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: MIT */ -/* SPDX-FileCopyrightText: 2022, 2023 Leah Rowe */ +/* SPDX-FileCopyrightText: 2022, 2023, 2025 Leah Rowe */ /* SPDX-FileCopyrightText: 2023 Riku Viitanen */ #include @@ -76,10 +76,11 @@ main(int argc, char *argv[]) filename = argv[1]; #ifdef __OpenBSD__ err_if(unveil("/dev/urandom", "r") == -1); - err_if(unveil(filename, flags == O_RDONLY ? "r" : "rw") == -1); if (flags == O_RDONLY) { + err_if(unveil(filename, "r") == -1); err_if(pledge("stdio rpath", NULL) == -1); } else { + err_if(unveil(filename, "rw") == -1); err_if(pledge("stdio rpath wpath", NULL) == -1); } #endif -- cgit v1.2.1