On Mon, Mar 25, 2013 at 4:22 PM, Jeff King <p...@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?

>         }
>         if (result && 0 <= fd)
>                 unlink(path);

Won't the unlink() now fail on Windows since 'fd' is still open?

-- ES
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to