mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-16 13:16:47 +02:00
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:
@@ -64,13 +64,13 @@ void (*cmd)(void) = NULL;
|
|||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
if (argc >= 2)
|
||||||
|
fname = argv[1];
|
||||||
#ifdef __OpenBSD__
|
#ifdef __OpenBSD__
|
||||||
err_if (pledge("stdio rpath wpath unveil", NULL) == -1);
|
err_if (pledge("stdio rpath wpath unveil", NULL) == -1);
|
||||||
err_if (unveil("/dev/urandom", "r") == -1);
|
err_if (unveil("/dev/urandom", "r") == -1);
|
||||||
#endif
|
#endif
|
||||||
set_cmd(argc, argv);
|
set_cmd(argc, argv);
|
||||||
|
|
||||||
fname = argv[1];
|
|
||||||
set_io_flags(argc, argv);
|
set_io_flags(argc, argv);
|
||||||
#ifdef __OpenBSD__
|
#ifdef __OpenBSD__
|
||||||
if (flags == O_RDONLY) {
|
if (flags == O_RDONLY) {
|
||||||
|
|||||||
Reference in New Issue
Block a user