Merge branch 'cb/compat-mmap-is-private-read-only'

Code tightening.

* cb/compat-mmap-is-private-read-only:
  compat: make sure git_mmap is not expected to write
maint
Junio C Hamano 2018-10-30 15:43:49 +09:00
commit a70d7827ac
1 changed files with 1 additions and 1 deletions

View File

@ -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);