Skip to content

Commit

Permalink
Close file if mmap is not used
Browse files Browse the repository at this point in the history
  • Loading branch information
Sirraide committed Jul 22, 2023
1 parent 222afb4 commit ff04bda
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions include/clopts.hh
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ static file_data_type map_file(
/// Read the file manually.
auto f = std::fopen(path.data(), "rb");
if (not f) return err(path);
at_scope_exit _close_file = [&] { std::fclose(f); };

/// Get the file size.
std::fseek(f, 0, SEEK_END);
Expand Down

0 comments on commit ff04bda

Please sign in to comment.