boostorg / boostorg/iostreams

boost::iostream::mapped_file_impl::map_file Cannot retry mapping with hint under Windows

Open
#99 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
48
Forks
124
PR merge metrics
No merged PRs in 30d

Description

Code in mapped_file.cpp
```
void mapped_file_impl::map_file(param_type& p)
{
try {
try_map_file(p);
} catch (const std::exception&) {
if (p.hint) {
p.hint = 0;
try_map_file(p);
} else {
throw;
}
}
}
```

As I see, function should try secondary mapping without hint if mapping with hint is failed.
Windows version has two handles ( `handle_` for file and `mapped_handle_` for mapping). Function `cleanup_and_throw` will be called If mapping failed. It will close both handles. But It is necessary to close only mapping handle for second try of mapping.
So Second try always fails under Windows if nonzero hint is passed.
*nix version has only one handle and it works.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.