summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorCarlo Marcelo Arenas Belón <carenas@gmail.com>2018-10-23 12:35:19 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-10-25 09:51:03 (GMT)
commitbf1e6da79157ff765fc92b45ac96442b9f56ff8b (patch)
tree905bf81a5114df782d6f4a48457dc4741ba1a669 /compat
parent40f327faf543ccaeb03aa0362f3fed7438c2c615 (diff)
downloadgit-bf1e6da79157ff765fc92b45ac96442b9f56ff8b.zip
git-bf1e6da79157ff765fc92b45ac96442b9f56ff8b.tar.gz
git-bf1e6da79157ff765fc92b45ac96442b9f56ff8b.tar.bz2
compat: make sure git_mmap is not expected to write
in f48000fc ("Yank writing-back support from gitfakemmap.", 2005-10-08) support for writting back changes was removed but the specific prot flag that would be used was not checked for Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com> Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat')
-rw-r--r--compat/mmap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/compat/mmap.c b/compat/mmap.c
index 7f662fe..14d3101 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);