Date: Thu, 6 Jun 2024 17:06:42 GMT From: Allan Jude <allanjude@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 63f5c101a1fd - main - comm: flush stdout for error checking prior to exiting Message-ID: <202406061706.456H6gJq073610@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by allanjude: URL: https://cgit.FreeBSD.org/src/commit/?id=63f5c101a1fdf4e8b94c5d76afcd6cbf0b2c79da commit 63f5c101a1fdf4e8b94c5d76afcd6cbf0b2c79da Author: Cosimo Cecchi <cosimo@apple.com> AuthorDate: 2024-06-06 16:51:22 +0000 Commit: Allan Jude <allanjude@FreeBSD.org> CommitDate: 2024-06-06 17:04:37 +0000 comm: flush stdout for error checking prior to exiting UNIX conformance wants utilities to catch any errors when doing I/O, as opposed to relying on the implicit flush upon exit. comm currently does not do that. This commit adds handling of I/O errors on stdout prior to exit. Reviewed by: imp, allanjude Sponsored by: Apple Inc. Differential Revision: https://reviews.freebsd.org/D45439 --- usr.bin/comm/comm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr.bin/comm/comm.c b/usr.bin/comm/comm.c index b8fb10ccddb4..2f305e23ce8f 100644 --- a/usr.bin/comm/comm.c +++ b/usr.bin/comm/comm.c @@ -172,6 +172,8 @@ main(int argc, char *argv[]) (void)printf("%s%s\n", col2, line2); } } + if (ferror(stdout) != 0 || fflush(stdout) != 0) + err(1, "stdout"); exit(0); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202406061706.456H6gJq073610>