From: Junio C Hamano <junkio@cox•net>
To: "Shawn O. Pearce" <spearce@spearce•org>
Cc: git@vger•kernel.org
Subject: Re: [PATCH 1/2] Don't leak file descriptors from unavailable pack files.
Date: Fri, 02 Feb 2007 00:37:54 -0800 [thread overview]
Message-ID: <7vbqkdhs4d.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <20070202080003.GA21094@spearce.org> (Shawn O. Pearce's message of "Fri, 2 Feb 2007 03:00:03 -0500")
"Shawn O. Pearce" <spearce@spearce•org> writes:
> If open_packed_git failed it may have been because the packfile
> actually exists and is readable, but some sort of verification
> did not pass. In this case open_packed_git left pack_fd filled
> in, as the file descriptor is valid.
> if (p->pack_fd == -1 && open_packed_git(p)) {
> + if (p->pack_fd != -1) {
> + close(p->pack_fd);
> + p->pack_fd = -1;
> + }
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?
next prev parent reply other threads:[~2007-02-02 8:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-02 8:00 [PATCH 1/2] Don't leak file descriptors from unavailable pack files Shawn O. Pearce
2007-02-02 8:37 ` Junio C Hamano [this message]
2007-02-02 8:53 ` Shawn O. Pearce
2007-02-03 5:33 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vbqkdhs4d.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox$(echo .)net \
--cc=git@vger$(echo .)kernel.org \
--cc=spearce@spearce$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox