git: 9e379f9639d5 - main - asa: Error out if writing to stdout failed.

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Thu, 15 Jun 2023 19:28:01 UTC
The branch main has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=9e379f9639d51442ad1d5e1800c687ef2c954901

commit 9e379f9639d51442ad1d5e1800c687ef2c954901
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2023-06-15 19:23:19 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2023-06-15 19:24:58 +0000

    asa: Error out if writing to stdout failed.
    
    MFC after:      1 week
    Sponsored by:   Klara, Inc.
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D40562
---
 usr.bin/asa/asa.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/usr.bin/asa/asa.c b/usr.bin/asa/asa.c
index 22174ed340cd..11438b607466 100644
--- a/usr.bin/asa/asa.c
+++ b/usr.bin/asa/asa.c
@@ -81,6 +81,9 @@ main(int argc, char *argv[])
 		}
 	}
 
+	if (fflush(stdout) != 0)
+		err(1, "stdout");
+
 	exit(exval);
 }
 
@@ -140,4 +143,7 @@ asa(FILE *f)
 
 		putchar('\n');
 	}
+
+	if (ferror(stdout) != 0)
+		err(1, "stdout");
 }