Commit 0fab748e by Edward Thomson

Merge pull request #2685 from libgit2/cmn/mmap-readable

Fix segmentation fault observed on OpenBSD/sparc64
parents 2cc6011e aad0bd6b
...@@ -26,7 +26,7 @@ int git__page_size(size_t *page_size) ...@@ -26,7 +26,7 @@ int git__page_size(size_t *page_size)
int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offset) int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offset)
{ {
int mprot = 0; int mprot = PROT_READ;
int mflag = 0; int mflag = 0;
GIT_MMAP_VALIDATE(out, len, prot, flags); GIT_MMAP_VALIDATE(out, len, prot, flags);
...@@ -35,9 +35,7 @@ int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offs ...@@ -35,9 +35,7 @@ int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offs
out->len = 0; out->len = 0;
if (prot & GIT_PROT_WRITE) if (prot & GIT_PROT_WRITE)
mprot = PROT_WRITE; mprot |= PROT_WRITE;
else if (prot & GIT_PROT_READ)
mprot = PROT_READ;
if ((flags & GIT_MAP_TYPE) == GIT_MAP_SHARED) if ((flags & GIT_MAP_TYPE) == GIT_MAP_SHARED)
mflag = MAP_SHARED; mflag = MAP_SHARED;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment