util/nvmutil: make it compile again

i was reorganising the state machine (singleton)
used for data, and part of what i wanted lead
to mkhtemp being written.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-24 04:43:52 +00:00
parent 61ee661b88
commit 616099edad
3 changed files with 14 additions and 10 deletions

View File

@@ -127,6 +127,7 @@ set_cmd(int argc, char *argv[])
"Too few args on command '%s'", cmd);
}
x->no_cmd = 1;
}

View File

@@ -105,14 +105,10 @@ xstart(int argc, char *argv[])
us.f.tmp_fd = -1;
us.f.tname = NULL;
if (new_tmpfile(&us.f.tmp_fd, &us.f.tname) < 0)
err_no_cleanup(errno, "%s", us.f.tname);
/* parse user command */
/* TODO: CHECK ACCESSES VIA xstatus() */
set_cmd(argc, argv);
set_cmd_args(argc, argv);
if (us.f.tname == NULL)
err_no_cleanup(errno, "x->f.tname null");
if (*us.f.tname == '\0')
@@ -138,8 +134,6 @@ xstatus(void)
if (x == NULL)
err_no_cleanup(EACCES, "NULL pointer to xstate");
sanitize_command_list();
return x;
}
@@ -180,10 +174,11 @@ getnvmprogname(void)
char *rval = fallback;
if (x != NULL) {
if (x->argv0 == NULL || *x->argv0 == '\0')
return "";
rval = x->argv0;
if (x->argv0 != NULL && *x->argv0 != '\0')
rval = x->argv0;
else
return fallback;
}
p = strrchr(rval, '/');

View File

@@ -62,6 +62,11 @@ main(int argc, char *argv[])
if (x == NULL)
err_no_cleanup(ECANCELED, "NULL state on init");
/* parse user command */
/* TODO: CHECK ACCESSES VIA xstatus() */
set_cmd(argc, argv);
set_cmd_args(argc, argv);
cmd = &x->cmd[x->i];
f = &x->f;
@@ -96,6 +101,9 @@ main(int argc, char *argv[])
if (cmd->run == NULL)
err(errno, "Command not set");
sanitize_command_list();
open_gbe_file();
copy_gbe();