summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2018-10-30 15:43:49 +0900
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-10-30 15:43:49 +0900
commita70d7827ac071b9e4242ae7d145ce27013d8b928 (patch)
treece6d0d01173589783814af015b6c6c676cfc6d0a
parentMerge branch 'dl/mergetool-gui-option' (diff)
parentcompat: make sure git_mmap is not expected to write (diff)
downloadtgif-a70d7827ac071b9e4242ae7d145ce27013d8b928.tar.xz
Merge branch 'cb/compat-mmap-is-private-read-only'
Code tightening. * cb/compat-mmap-is-private-read-only: compat: make sure git_mmap is not expected to write
-rw-r--r--compat/mmap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/compat/mmap.c b/compat/mmap.c
index 7f662fef7b..14d31010df 100644
--- a/compat/mmap.c
+++ b/compat/mmap.c
@@ -4,7 +4,7 @@ void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t of
{
size_t n = 0;
- if (start != NULL || !(flags & MAP_PRIVATE))
+ if (start != NULL || flags != MAP_PRIVATE || prot != PROT_READ)
die("Invalid usage of mmap when built with NO_MMAP");
start = xmalloc(length);