Re: git: c2d93a803ace - main - env: Check the status of stdout.

From: Dag-Erling_Smørgrav <des_at_FreeBSD.org>
Date: Tue, 08 Oct 2024 18:40:45 UTC
Konstantin Belousov <kostikbel@gmail.com> writes:
> Dag-Erling Smørgrav <des@FreeBSD.org> writes:
> > +	if (fflush(stdout) != 0)
> > +		err(1, "stdout");
> Why is this check needed?

POSIX requires it.

> Or, put it differently, why is it needed for env(1) but not any other
> program that writes to stdout?

You mean like these?

% git -P grep -l 'err\(1, "stdout"\)'
bin/cat/cat.c
bin/date/date.c
sbin/md5/md5.c
usr.bin/asa/asa.c
usr.bin/comm/comm.c
usr.bin/ctags/ctags.c
usr.bin/du/du.c
usr.bin/env/env.c
usr.bin/head/head.c
usr.bin/join/join.c
usr.bin/lastcomm/lastcomm.c
usr.bin/locate/code/locate.code.c
usr.bin/ncal/ncal.c
usr.bin/sed/main.c
usr.bin/tail/misc.c
usr.bin/tsort/tsort.c
usr.bin/w/w.c
usr.bin/yes/yes.c

or these?

https://reviews.freebsd.org/D41390
https://reviews.freebsd.org/D41408
https://reviews.freebsd.org/D41413
https://reviews.freebsd.org/D41414
https://reviews.freebsd.org/D41417
https://reviews.freebsd.org/D41418
https://reviews.freebsd.org/D41422
https://reviews.freebsd.org/D41423
https://reviews.freebsd.org/D41424
https://reviews.freebsd.org/D41427
https://reviews.freebsd.org/D41428
https://reviews.freebsd.org/D41432

DES
-- 
Dag-Erling Smørgrav - des@FreeBSD.org