From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Hoyoung Lee <lhywkd22@gmail.com>, 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 07:53:37 -0700 [thread overview]
Message-ID: <xmqq34aouvim.fsf@gitster.g> (raw)
In-Reply-To: <20250722082643.GD862006@coredump.intra.peff.net> (Jeff King's message of "Tue, 22 Jul 2025 04:26:43 -0400")
Jeff King <peff@peff.net> writes:
> 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.
;-)
Thanks for taking a look on these patches before I wake up, so I
didn't have to ;-)
next prev parent reply other threads:[~2025-07-22 14:53 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
2025-07-22 14:53 ` Junio C Hamano [this message]
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=xmqq34aouvim.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=lhywkd22@gmail.com \
--cc=peff@peff.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.