Re: [PATCH 2/8] Add a lockfile function to append to a file
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Apr 20, 2008, 16:14 UTC
- Message-ID
- <alpine.DEB.1.00.0804201714230.5084@eeepc-johanness>
- In-Reply-To
- <7vtzhxce9g.fsf@gitster.siamese.dyndns.org>
Hi,
On Sat, 19 Apr 2008, Junio C Hamano wrote:
Show 13 quoted lines
> Daniel Barkalow <barkalow@iabervon.org> writes: > > > This takes care of copying the original contents into the replacement > > file after the lock is held, so that concurrent additions can't miss > > each other's changes. > > > > Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> > > --- > > How about this? Also doesn't leak a fd and catches trying to append to a > > file you can't read. Should I worry about mmap failing after the open? > > We have copy.c to copy small existing files, while detecting failure to > copy properly. How about doing something like this instead?
I like it.
Ciao, Dscho