raii_mmaped_locked_file::~raii_mmaped_locked_file()
{
- munmap(map, file.get_stat().st_size);
+ if (map != nullptr) {
+ munmap(map, file.get_stat().st_size);
+ }
}
raii_mmaped_locked_file::raii_mmaped_locked_file(raii_mmaped_locked_file &&other) noexcept
raii_locked_file() = delete;
raii_locked_file(const raii_locked_file &other) = delete;
private:
- int fd;
+ int fd = -1;
bool temp;
std::string fname;
struct stat st;
/* Is intended to be used with map_shared */
explicit raii_mmaped_locked_file(raii_locked_file &&_file, void *_map);
raii_locked_file file;
- void *map{};
+ void *map = nullptr;
};
/**