diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-03 14:24:19 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-03 14:24:19 +0000 |
| commit | d37726c35316079a1b3b894db6616104c83ba52f (patch) | |
| tree | e6e6bac0a130fb081b37a9397014f387e398e88c /util | |
| parent | 65a2f352eeefcdcebb758e31bbd4ef3c9692b519 (diff) | |
util/nvmutil: set fname earlier
this fixes the bug where if you specify an invalid command
such as:
./nvm gbe brick 9
part 9 doesn't exist, but fname isn't yet set, here.
same thing applys when running those pledge commands on
openbsd.
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util')
| -rw-r--r-- | util/nvmutil/nvmutil.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 83ac6c83..227a2674 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -64,13 +64,13 @@ void (*cmd)(void) = NULL; int main(int argc, char *argv[]) { + if (argc >= 2) + fname = argv[1]; #ifdef __OpenBSD__ err_if (pledge("stdio rpath wpath unveil", NULL) == -1); err_if (unveil("/dev/urandom", "r") == -1); #endif set_cmd(argc, argv); - - fname = argv[1]; set_io_flags(argc, argv); #ifdef __OpenBSD__ if (flags == O_RDONLY) { |
