Skip to content

Commit 520fc24

Browse files
author
Linus Torvalds
committed
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.
1 parent b0fe89c commit 520fc24

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

read-cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ int read_cache(void)
198198
size = st.st_size;
199199
errno = EINVAL;
200200
if (size >= sizeof(struct cache_header) + 20)
201-
map = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
201+
map = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
202202
}
203203
close(fd);
204204
if (-1 == (int)(long)map)

0 commit comments

Comments
 (0)