From: Jeff King Date: Mon, 25 Mar 2013 21:37:37 GMT Subject: Re: [PATCH 6/9] streaming_write_entry: propagate streaming errors Message-ID: <20130325213737.GC19303@sigill.intra.peff.net> In-Reply-To: On Mon, Mar 25, 2013 at 05:35:51PM -0400, Eric Sunshine wrote: > On Mon, Mar 25, 2013 at 4:22 PM, Jeff King wrote: > > diff --git a/entry.c b/entry.c > > index 17a6bcc..002b2f2 100644 > > --- a/entry.c > > +++ b/entry.c > > @@ -126,8 +126,10 @@ static int streaming_write_entry(struct cache_entry *ce, char *path, > > fd = open_output_fd(path, ce, to_tempfile); > > if (0 <= fd) { > > result = stream_blob_to_fd(fd, ce->sha1, filter, 1); > > - *fstat_done = fstat_output(fd, state, statbuf); > > - result = close(fd); > > + if (!result) { > > + *fstat_done = fstat_output(fd, state, statbuf); > > + result = close(fd); > > + } > > Is this intentionally leaking the opened 'fd' when stream_blob_to_fd() > returns an error? Good catch. I was so focused on making sure we still called unlink that I forgot about the cleanup side-effect of close. I'll re-roll it. -Peff