diff --git a/fineftp-server/src/unix/file_man.cpp b/fineftp-server/src/unix/file_man.cpp index a91259a..80be685 100644 --- a/fineftp-server/src/unix/file_man.cpp +++ b/fineftp-server/src/unix/file_man.cpp @@ -27,7 +27,7 @@ ReadableFile::~ReadableFile() ::munmap(data_, size_); } - std::lock_guard lock{guard}; + const std::lock_guard lock{guard}; if (!pth_.empty()) { (void)files.erase(pth_); @@ -37,7 +37,7 @@ ReadableFile::~ReadableFile() std::shared_ptr ReadableFile::get(const std::string& pth) { // See if we already have this file mapped - std::lock_guard lock{guard}; + const std::lock_guard lock{guard}; auto fit = files.find(pth); if (files.end() != fit) { @@ -54,14 +54,14 @@ std::shared_ptr ReadableFile::get(const std::string& pth) return {}; } - struct stat st; + struct stat st {}; if (-1 == ::fstat(handle, &st)) { ::close(handle); return {}; } - auto map_start = ::mmap(0, st.st_size, PROT_READ, MAP_SHARED, handle, 0); + auto* map_start = ::mmap(nullptr, st.st_size, PROT_READ, MAP_SHARED, handle, 0); if (MAP_FAILED == map_start) { ::close(handle);