From: Jeff King <peff@peff.net>
To: Hoyoung Lee <lhywkd22@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v2 4/4] t/helper/test-delta: close fd if fstat() fails after second open()
Date: Tue, 22 Jul 2025 04:26:43 -0400 [thread overview]
Message-ID: <20250722082643.GD862006@coredump.intra.peff.net> (raw)
In-Reply-To: <20250722082557.GC862006@coredump.intra.peff.net>
On Tue, Jul 22, 2025 at 04:25:57AM -0400, Jeff King wrote:
> > int output_fd = xopen(output_file, O_CREAT | O_WRONLY | O_TRUNC, 0666);
> > if (output_fd != 1) {
> > - if (dup2(output_fd, 1) < 0)
> > + if (dup2(output_fd, 1) < 0) {
> > close(output_fd);
> > die_errno(_("could not redirect output"));
> > + }
> > else
> > close(output_fd);
> > }
>
> Ah, I guess you found the problem from patch 3. But it should have been
> squashed in there, not to this patch. (But as I said there, I think we
> should just drop patch 3 entirely).
Er, sorry, I meant patch 2. Counting is hard.
-Peff
next prev parent reply other threads:[~2025-07-22 8:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-22 8:12 [PATCH 0/4] Fix resource leaks in various helpers and builtin commands Hoyoung Lee
2025-07-22 8:12 ` [PATCH v2 1/4] t/helper/test-truncate: close file descriptor after truncation Hoyoung Lee
2025-07-22 8:12 ` [PATCH v2 2/4] builtin/archive: close file descriptor on dup2() failure Hoyoung Lee
2025-07-22 8:24 ` Jeff King
2025-07-22 8:12 ` [PATCH v2 3/4] t/helper/test-delta: close fd if fstat() fails after open() Hoyoung Lee
2025-07-22 8:36 ` Eric Sunshine
2025-07-22 8:40 ` Jeff King
2025-07-22 8:12 ` [PATCH v2 4/4] t/helper/test-delta: close fd if fstat() fails after second open() Hoyoung Lee
2025-07-22 8:25 ` Jeff King
2025-07-22 8:26 ` Jeff King [this message]
2025-07-22 14:53 ` Junio C Hamano
2025-07-22 8:35 ` [PATCH 0/4] Fix resource leaks in various helpers and builtin commands Jeff King
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=20250722082643.GD862006@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=lhywkd22@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).