From: Patrick Steinhardt Date: Wed, 15 Jul 2026 06:58:38 GMT Subject: Re: [PATCH 11/11] bisect: handle dup() failure when redirecting stdout Message-ID: In-Reply-To: <2da452e39cbe1bd53da9d76fa7f7615c1a453634.1784069325.git.gitgitgadget@gmail.com> On Tue, Jul 14, 2026 at 10:48:44PM +0000, Johannes Schindelin via GitGitGadget wrote: > 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