diff options
| author | Ada Christine <adachristine18@gmail.com> | 2025-01-23 20:42:01 +0000 |
|---|---|---|
| committer | Ada Christine <adachristine18@gmail.com> | 2025-01-23 20:42:01 +0000 |
| commit | 5d6ce9fbff452acac933c4bba225a93520c9c5d2 (patch) | |
| tree | a6976863cef4762e37ea2c7690c0a3c026d97739 /boot/efi/file.c | |
| parent | d855c0a219a180497c2e50f9bc19bfce69b937a6 (diff) | |
wrong comparison, broke file closing
Diffstat (limited to 'boot/efi/file.c')
| -rw-r--r-- | boot/efi/file.c | 6 |
1 files changed, 3 insertions, 3 deletions
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; } |
