From a2dda29cf6e61ce8fced567cf256438194b8caa9 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Sun, 28 Oct 2018 12:48:27 -0500 Subject: [PATCH] Fix build on macOS Yosemite Older versions of the macOS dev toolchain use MAP_ANON instead of MAP_ANONYMOUS. We already do this elsewhere. --- src/history.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/history.cpp b/src/history.cpp index d96ffefdc..996a14852 100644 --- a/src/history.cpp +++ b/src/history.cpp @@ -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; }