From ebffecf04b4a77b83e763651957db5e4a9c488a4 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 14 Mar 2026 18:19:25 +0000 Subject: util/nvmutil: guard against unlinking file if someone deletes gbe.bin while operating, nvmutil will now abort Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 3 +++ 1 file changed, 3 insertions(+) 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); -- cgit v1.2.1