Skip to content

Commit

Permalink
Fixed clang-tidy warnings on ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianReimold committed Nov 2, 2023
1 parent a7a7932 commit c148060
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fineftp-server/src/unix/file_man.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ReadableFile::~ReadableFile()
::munmap(data_, size_);
}

std::lock_guard<std::mutex> lock{guard};
const std::lock_guard<std::mutex> lock{guard};
if (!pth_.empty())
{
(void)files.erase(pth_);
Expand All @@ -37,7 +37,7 @@ ReadableFile::~ReadableFile()
std::shared_ptr<ReadableFile> ReadableFile::get(const std::string& pth)
{
// See if we already have this file mapped
std::lock_guard<std::mutex> lock{guard};
const std::lock_guard<std::mutex> lock{guard};
auto fit = files.find(pth);
if (files.end() != fit)
{
Expand All @@ -54,14 +54,14 @@ std::shared_ptr<ReadableFile> 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);
Expand Down

0 comments on commit c148060

Please sign in to comment.