From: Johannes Schindelin Date: Sat, 23 May 2009 08:53:41 GMT Subject: Re: Funny error with git gc... Message-ID: In-Reply-To: Hi, On Fri, 15 May 2009, Linus Torvalds wrote: > On Fri, 15 May 2009, Johannes Schindelin wrote: > > > > fd = mkstemp(template); > > + if (fd < 0) { > > + release_pack_memory((size_t)-1ll, -1); > > + fd = mkstemp(template); > > This is wrong. You can't use "template" twice. You need to re-initialize > it. The first one will blow away the XXXX pattern. Turns out that would be awkward, as the xmkstemp() function would have to copy the template just in case mkstemp() fails due to too many open files, and of course it would need to release the copy afterwards. OTOH we cannot just use the initialized filename, because there might be a race condition with another process, right? Ciao, Dscho