From 5d6ce9fbff452acac933c4bba225a93520c9c5d2 Mon Sep 17 00:00:00 2001 From: Ada Christine Date: Thu, 23 Jan 2025 20:42:01 +0000 Subject: wrong comparison, broke file closing --- boot/efi/file.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'boot') diff --git a/boot/efi/file.c b/boot/efi/file.c index e45ce78..56c0345 100644 --- a/boot/efi/file.c +++ b/boot/efi/file.c @@ -31,7 +31,7 @@ static EFI_SIMPLE_TEXT_INPUT_PROTOCOL *fd_to_inconsole(int fd) return fd == STDIN_FILENO ? efi_context->system_table->ConIn : nullptr; } -static EFI_FILE_PROTOCOL *open_files[FD_COUNT]; +static EFI_FILE_PROTOCOL *open_files[FD_COUNT] = { nullptr }; static EFI_FILE_PROTOCOL *fd_to_file(int fd) { @@ -58,7 +58,7 @@ static int alloc_fd(void) static void free_fd(int fd) { - if (fd < FD_MIN || fd > FD_MAX) + if (fd >= FD_MIN && fd <= FD_MAX) { open_files[fd] = nullptr; } @@ -104,7 +104,7 @@ int efi_open(const char *path, int flags, int mode) int fd = alloc_fd(); - if (fd < FD_MIN) + if (fd < FD_MIN || fd > FD_MAX) { return -1; } -- cgit v1.3.1-1-g115d