Subject: Re: [PATCH 1/2] Don't leak file descriptors from unavailable pack files.

From: "Shawn O. Pearce" <[email-masked]>
Date: Fri, 2 Feb 2007 03:53:43 -0500

Junio C Hamano <[email-masked]> wrote:
> I agree leaking fd is not nice, but I wonder if that should be
> dealt with by the caller.
> 
> Originally it did not matter as open_packed_git() died, but
> shouldn't it be closing the fd and marking p->pack_fd with -1, as
> you made it return instead of die?

Yea, I thought of that when I wrote that evil patch...

But open_packed_git has 12 things that can cause it to return
an error.  That's basically a rewrite of the function.  This was
4 lines added to the only caller which didn't die().

Probably the wrong thing to do.  But the patch was shorter!

Do you want to reject this patch and have me rewrite open_packed_git
instead?

-- 
Shawn.