From: Carlo Marcelo Arenas Belón Date: Tue, 23 Oct 2018 12:35:19 +0000 (-0700) Subject: compat: make sure git_mmap is not expected to write X-Git-Tag: v2.20.0-rc0~99^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bf1e6da79157ff765fc92b45ac96442b9f56ff8b;p=thirdparty%2Fgit.git 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 Acked-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- 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);