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>
This commit is contained in:
Leah Rowe
2026-03-14 18:19:25 +00:00
parent 7eadaf2894
commit e162d63ae6
+3
View File
@@ -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);