diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-24 04:29:31 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-24 04:29:31 +0000 |
| commit | 61ee661b886508d158702f9925af02464e227c3a (patch) | |
| tree | 1fd47216b90317a37f20cd60bc97578baa7e79e5 | |
| parent | 8b8a5635c3f412183f16abc368019bae79f7857f (diff) | |
nvmutil/state: remove unnecessary check
Signed-off-by: Leah Rowe <leah@libreboot.org>
| -rw-r--r-- | util/libreboot-utils/lib/state.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/util/libreboot-utils/lib/state.c b/util/libreboot-utils/lib/state.c index d06a8869..f9be230f 100644 --- a/util/libreboot-utils/lib/state.c +++ b/util/libreboot-utils/lib/state.c @@ -26,7 +26,6 @@ struct xstate * xstart(int argc, char *argv[]) { static int first_run = 1; - static int pre_init = 0; static struct xstate us = { /* DO NOT MESS THIS UP, OR THERE WILL BE DEMONS */ @@ -89,15 +88,8 @@ xstart(int argc, char *argv[]) }; - if (!first_run) { - if (pre_init) - err_no_cleanup(ECANCELED, - "Outside access to state during init"); - - first_run = 0; - + if (!first_run) return &us; - } if (argc < 3) err_no_cleanup(EINVAL, "xstart: Too few arguments"); @@ -105,15 +97,16 @@ xstart(int argc, char *argv[]) err_no_cleanup(EINVAL, "xstart: NULL argv"); first_run = 0; - pre_init = 1; us.f.buf = us.f.real_buf; us.argv0 = argv[0]; us.f.fname = argv[1]; + us.f.tmp_fd = -1; + us.f.tname = NULL; if (new_tmpfile(&us.f.tmp_fd, &us.f.tname) < 0) - err_no_cleanup(errno, "xstart: cannot create tmpfile"); + err_no_cleanup(errno, "%s", us.f.tname); /* parse user command */ /* TODO: CHECK ACCESSES VIA xstatus() */ @@ -134,8 +127,6 @@ xstart(int argc, char *argv[]) /* for good measure */ memset(us.f.pad, 0, sizeof(us.f.pad)); - pre_init = 0; - return &us; } |
