Commit bf1e6da7 authored by Carlo Marcelo Arenas Belón's avatar Carlo Marcelo Arenas Belón Committed by Junio C Hamano

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: default avatarCarlo Marcelo Arenas Belón <carenas@gmail.com>
Acked-by: Johannes Schindelin's avatarJohannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
parent 40f327fa
......@@ -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);
......
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