From: Linus Torvalds Date: Wed, 27 Apr 2005 02:27:27 +0000 (-0700) Subject: Allow writing to the private index file mapping. X-Git-Tag: v0.99~730 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=520fc2415e83c0adfc1186ee922472c338cb4146;p=git.git Allow writing to the private index file mapping. We now modify the in-memory copy of the index file in "diff-cache", so we need to add PROT_WRITE. --- diff --git a/read-cache.c b/read-cache.c index 2354e803..53f1da81 100644 --- a/read-cache.c +++ b/read-cache.c @@ -198,7 +198,7 @@ int read_cache(void) size = st.st_size; errno = EINVAL; if (size >= sizeof(struct cache_header) + 20) - map = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0); + map = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); } close(fd); if (-1 == (int)(long)map)