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>
This commit is contained in:
Leah Rowe
2026-03-03 14:24:19 +00:00
parent 65a2f352ee
commit d37726c353
+2 -2
View File
@@ -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) {