Browse Source

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 6 years ago
parent
commit
a70d7827ac
  1. 2
      compat/mmap.c

2
compat/mmap.c

@ -4,7 +4,7 @@ void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t of @@ -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);

Loading…
Cancel
Save