mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-03-25 13:29:03 +02:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user