Re: First cut at git port to Cygwin
Hi,
On Sat, 8 Oct 2005, Junio C Hamano wrote:
Show 8 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> > Am I missing something? I don't see where the changes are written back to
> > the fd. After all, mmap() is called with PROT_WRITE...
>
> PROT_WRITE is true, but we do MAP_PRIVATE, and if I recall
> correctly we do not write file via mmap -- at least we do not
> intend to.
Ahh! Reading the man page helps!
> Yes. It might have been overkill that you supported writing
> changes back, though.
Sure. Something like this?
diff --git a/compat/mmap.c b/compat/mmap.c
index fca6321..fda39fc 100644
--- a/compat/mmap.c
+++ b/compat/mmap.c
@@ -49,7 +49,7 @@ void *gitfakemmap(void *start, size_t le
n += count;
}
- if(prot & PROT_WRITE) {
+ if((prot & PROT_WRITE) && !(flags & MAP_PRIVATE)) {
fakemmapwritable *next = xmalloc(sizeof(fakemmapwritable));
next->start = start;
next->length = length;