Fix build on macOS Yosemite

Older versions of the macOS dev toolchain use MAP_ANON instead of
MAP_ANONYMOUS. We already do this elsewhere.
This commit is contained in:
Mahmoud Al-Qudsi
2018-10-28 12:48:27 -05:00
parent 203de775d0
commit a2dda29cf6

View File

@@ -314,7 +314,11 @@ class history_file_contents_t {
// We don't want to map the file. mmap some private memory and then read into it. We use
// mmap instead of malloc so that the destructor can always munmap().
mmap_start =
#ifdef MAP_ANON
mmap(0, size_t(len), PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
#else
mmap(0, size_t(len), PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
#endif
if (mmap_start == MAP_FAILED) return nullptr;
if (!read_from_fd(fd, mmap_start, len)) return nullptr;
}