diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-24 18:46:36 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-24 18:46:36 +0000 |
| commit | c1befbcd3eb4a51831260c7c7b743a673512e6a5 (patch) | |
| tree | 04fee08997783de473bdd69d12f6b6cfc4c2b558 /util/libreboot-utils/lib/state.c | |
| parent | 6593e76c6a17d1e0cb82a2f29e832348fa9aa5ca (diff) | |
util/nvmutil: never do cross-filesystem moves
make a local TMPDIR instead, where gbe.bin is.
this avoids the EXDEV errno, so we don't have
to handle it, and it's just better performant
for everyone.
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/libreboot-utils/lib/state.c')
| -rw-r--r-- | util/libreboot-utils/lib/state.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/util/libreboot-utils/lib/state.c b/util/libreboot-utils/lib/state.c index 2fc22d52..2d2f6087 100644 --- a/util/libreboot-utils/lib/state.c +++ b/util/libreboot-utils/lib/state.c @@ -26,6 +26,9 @@ struct xstate * xstart(int argc, char *argv[]) { static int first_run = 1; + static char *dir = NULL; + static char *base = NULL; + char *realdir = NULL; static struct xstate us = { { @@ -107,7 +110,15 @@ 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) + if ((realdir = realpath(us.f.fname, NULL)) == NULL) + err_no_cleanup(errno, "xstart: can't get realpath of %s", + us.f.fname); + + if (fs_dirname_basename(realdir, &dir, &base, 0) < 0) + err_no_cleanup(errno, "xstart: don't know CWD of %s", + us.f.fname); + + if (new_tmpfile(&us.f.tmp_fd, &us.f.tname, dir) < 0) err_no_cleanup(errno, "%s", us.f.tname); if (us.f.tname == NULL) |
