Re: [PATCH 11/11] bisect: handle dup() failure when redirecting stdout
On Tue, Jul 14, 2026 at 10:48:44PM +0000, Johannes Schindelin via GitGitGadget wrote:
Show 14 quoted lines
> diff --git a/builtin/bisect.c b/builtin/bisect.c
> index 15a2a30f89..801daf8c78 100644
> --- a/builtin/bisect.c
> +++ b/builtin/bisect.c
> @@ -1308,6 +1308,11 @@ static int bisect_run(struct bisect_terms *terms, int argc, const char **argv)
>
> fflush(stdout);
> saved_stdout = dup(1);
> + if (saved_stdout < 0) {
> + res = error_errno(_("could not duplicate stdout"));
> + close(temporary_stdout_fd);
> + break;
> + }
> dup2(temporary_stdout_fd, 1);Shouldn't we also verify the return value of `dup2()` while at it?
Patrick