Re: [PATCH 6/9] streaming_write_entry: propagate streaming errors
- From
Jeff King <peff@peff.net>
- Date
- Mar 25, 2013, 21:37 UTC
- Message-ID
- <20130325213737.GC19303@sigill.intra.peff.net>
- In-Reply-To
- <CAPig+cRjK6mrRm+K4Qzf2CsjT3SYGotZ2PrVLniYzdBRC1Mv2A@mail.gmail.com>
On Mon, Mar 25, 2013 at 05:35:51PM -0400, Eric Sunshine wrote:
Show 18 quoted lines
> On Mon, Mar 25, 2013 at 4:22 PM, Jeff King <peff@peff.net> 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