From 3522a235878900d8371db31ee7a18056861a3419 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 24 Mar 2026 19:13:59 +0000 Subject: 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 --- util/libreboot-utils/include/common.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'util/libreboot-utils/include/common.h') 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 -- cgit v1.2.1