Skip to content

Commit

Permalink
compat: make sure git_mmap is not expected to write
Browse files Browse the repository at this point in the history
in f48000f ("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 <[email protected]>
Acked-by: Johannes Schindelin <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
carenas authored and gitster committed Oct 25, 2018
1 parent 40f327f commit bf1e6da
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compat/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit bf1e6da

Please sign in to comment.