summaryrefslogtreecommitdiff
path: root/util/libreboot-utils
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-24 04:43:52 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-24 04:43:52 +0000
commit616099edade1d43893564177cbd31ff5f1c7eea0 (patch)
treeb671f2cc16df8dc4d0f3e78589935c7e9a3deaf1 /util/libreboot-utils
parent61ee661b886508d158702f9925af02464e227c3a (diff)
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>
Diffstat (limited to 'util/libreboot-utils')
-rw-r--r--util/libreboot-utils/lib/command.c1
-rw-r--r--util/libreboot-utils/lib/state.c15
-rw-r--r--util/libreboot-utils/nvmutil.c8
3 files changed, 14 insertions, 10 deletions
diff --git a/util/libreboot-utils/lib/command.c b/util/libreboot-utils/lib/command.c
index 3a863d23..94840191 100644
--- a/util/libreboot-utils/lib/command.c
+++ b/util/libreboot-utils/lib/command.c
@@ -127,6 +127,7 @@ set_cmd(int argc, char *argv[])
"Too few args on command '%s'", cmd);
}
+
x->no_cmd = 1;
}
diff --git a/util/libreboot-utils/lib/state.c b/util/libreboot-utils/lib/state.c
index f9be230f..a3ad0f1e 100644
--- a/util/libreboot-utils/lib/state.c
+++ b/util/libreboot-utils/lib/state.c
@@ -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, '/');
diff --git a/util/libreboot-utils/nvmutil.c b/util/libreboot-utils/nvmutil.c
index cb08ec43..fa6384b0 100644
--- a/util/libreboot-utils/nvmutil.c
+++ b/util/libreboot-utils/nvmutil.c
@@ -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();