git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Shawn O. Pearce <spearce@spearce.org>
Date
Feb 2, 2007, 08:53 UTC
Message-ID
<20070202085343.GD20832@spearce.org>
In-Reply-To
<7vbqkdhs4d.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> wrote:
Show 6 quoted lines
> 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.
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 4 in “Don't leak file descriptors from unavailable pack files.”
  1. 1/2 Don't leak file descriptors from unavailable pack files.Shawn O. Pearce, Feb 2, 2007
  2. Junio C HamanoFeb 2, 2007
  3. Shawn O. PearceFeb 2, 2007
  4. Junio C HamanoFeb 3, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.