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>
Carlo Marcelo Arenas Belón committed
Oct 23, 2018 at 05:35 UTC
bf1e6da79157ff765fc92b45ac96442b9f56ff8b
1 file changed
+1
-1
compat/mmap.c
+1
-1
@@ -4,7 +4,7 @@ void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t of
4
{
5
size_t n = 0;
6
7
- if (start != NULL || !(flags & MAP_PRIVATE))
7
+ if (start != NULL || flags != MAP_PRIVATE || prot != PROT_READ)
8
die("Invalid usage of mmap when built with NO_MMAP");
9
10
start = xmalloc(length);