From c1befbcd3eb4a51831260c7c7b743a673512e6a5 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 24 Mar 2026 18:46:36 +0000 Subject: 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 --- util/libreboot-utils/lib/state.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'util/libreboot-utils/lib/state.c') 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) -- cgit v1.2.1