Re: [PATCH 6/9] streaming_write_entry: propagate streaming errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 25, 2013 at 05:35:51PM -0400, Eric Sunshine wrote:

> On Mon, Mar 25, 2013 at 4:22 PM, Jeff King <peff@xxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]