summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-22 23:28:40 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-22 23:28:40 +0000
commitcf4be895f9e3c40cebc7c85ee049386b927d1ee3 (patch)
tree3372ea53a091331018e3faf45628aef0d3b16dcc /util
parent79376a900a72f47e5f18523d8d2d16c1bbd87438 (diff)
WIP verify after lock
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util')
-rw-r--r--util/nvmutil/lib/file.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/util/nvmutil/lib/file.c b/util/nvmutil/lib/file.c
index f3ef15cb..a4ce7b89 100644
--- a/util/nvmutil/lib/file.c
+++ b/util/nvmutil/lib/file.c
@@ -1001,11 +1001,8 @@ int secure_file(int *fd,
goto err_secure_file;
if (expected != NULL) {
- if (st_now.st_dev != expected->st_dev ||
- st_now.st_ino != expected->st_ino) {
- errno = ESTALE;
+ if (fd_verify_identity(*fd, expected, &st_now) < 0)
goto err_secure_file;
- }
}
*st = st_now;
@@ -1052,6 +1049,11 @@ int secure_file(int *fd,
if (do_lock) {
if (lock_file(*fd, flags) == -1)
goto err_secure_file;
+
+ if (expected != NULL) {
+ if (fd_verify_identity(*fd, expected, &st_now) < 0)
+ goto err_secure_file;
+ }
}
if (fchmod(*fd, mode) == -1)