summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-14 18:19:25 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-26 06:59:41 +0000
commite162d63ae60ae9dc7528463756aca3e25705beaf (patch)
treee89b9f277f47f01eeb94279c4e7c866413ad8cc2
parent7eadaf2894fdcb40f06db1e4afa8ee82c5439486 (diff)
util/nvmutil: guard against unlinking file
if someone deletes gbe.bin while operating, nvmutil will now abort Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r--util/nvmutil/nvmutil.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index a04ac7cb..3a6128f9 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -930,6 +930,9 @@ open_gbe_file(void)
xopen(&gbe_fd, fname,
command[cmd_index].flags | O_BINARY | O_NOFOLLOW, &gbe_st);
+ if (gbe_st.st_nlink == 0)
+ err(EIO, "%s: file unlinked while open", fname);
+
flags = fcntl(gbe_fd, F_GETFL);
if (flags == -1)
err(errno, "%s: fcntl(F_GETFL)", fname);