summaryrefslogtreecommitdiff
path: root/util/nvmutil
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-14 18:19:25 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-14 18:19:46 +0000
commitebffecf04b4a77b83e763651957db5e4a9c488a4 (patch)
tree91f9679b24b1aa184863a039e89a2167159cefab /util/nvmutil
parentcde085d54eb9375ed6acd8fdd04fad29ad005208 (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>
Diffstat (limited to 'util/nvmutil')
-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);