Skip to content

Commit

Permalink
call madvise only when mmap result is valid
Browse files Browse the repository at this point in the history
  • Loading branch information
Doekin committed Dec 9, 2024
1 parent 1e0a00e commit 2287b65
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/mmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ file_mapping::file_mapping(file_handle file, open_mode_t const mode, std::int64_
}

#if TORRENT_USE_MADVISE
if (file_size > 0)
if (m_mapping != nullptr && m_mapping != map_failed)
{
int const advise = ((mode & open_mode::sequential_access) ? MADV_SEQUENTIAL : 0)
#ifdef MADV_DONTDUMP
Expand Down

0 comments on commit 2287b65

Please sign in to comment.