summaryrefslogtreecommitdiff
path: root/util/libreboot-utils/include
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-24 19:13:59 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-24 19:19:33 +0000
commit3522a235878900d8371db31ee7a18056861a3419 (patch)
treef1eff6c09159623dceb0665bc23070a84188e413 /util/libreboot-utils/include
parent217ad55beda2201626c29b1429a94115f51f2f68 (diff)
util/nvmutil: use renameat for atomic write
not rename(). use renameat() this re-uses the logic added for mkhtemp. this will later enable more stringent integrity checks, though we already verify the integrity of a file after writing it back, and renameat is always tied to the descriptor, so it's fine. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/libreboot-utils/include')
-rw-r--r--util/libreboot-utils/include/common.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/util/libreboot-utils/include/common.h b/util/libreboot-utils/include/common.h
index 9429ddeb..b78b0c9c 100644
--- a/util/libreboot-utils/include/common.h
+++ b/util/libreboot-utils/include/common.h
@@ -287,6 +287,11 @@ struct xfile {
unsigned char bufcmp[GBE_BUF_SIZE]; /* compare gbe/tmp/reads */
unsigned char pad[GBE_WORK_SIZE]; /* the file that wouldn't die */
+
+ /* we later rename in-place, using old fd. renameat() */
+ int dirfd;
+ char *base;
+ char *tmpbase;
};
/* Command table, MAC address, files