Re: [PATCH 2/5] pager: do not close fd 2 unnecessarily
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 26, 2024, 21:26 UTC
- Message-ID
- <xmqqfru4e02s.fsf@gitster.g>
- In-Reply-To
- <e6c4dc8f-ffbf-4749-8086-22c29da768a7@gmail.com>
Rubén Justo <rjusto@gmail.com> writes:
Show 13 quoted lines
> On Wed, May 22, 2024 at 10:40:18AM -0700, Junio C Hamano wrote: > >> Not really. The name "old_fd2" strongly implies "where did fd#2 >> come from?" and it did not come from fd#0, did it? > > Perhaps "close_fd2" is a better name?: > @@ pager.c: static void close_pager_fds(void) > /* signal EOF to pager */ > close(1); > - close(2); > -+ if (old_fd2 != -1) > ++ if (close_fd2) > + close(2);
That's a very straight-forward name that says what effect anybody who assigns to the variable wants to see.