Module Name:    src
Committed By:   kre
Date:           Wed May 19 22:12:36 UTC 2021

Modified Files:
        src/bin/echo: echo.c

Log Message:
Catch up with /bin/sh built-in echo ... if a write error occurs,
don't just exit(1), write an error message to stderr as well
(required for POSIX conformance).


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/bin/echo/echo.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/echo/echo.c
diff -u src/bin/echo/echo.c:1.19 src/bin/echo/echo.c:1.20
--- src/bin/echo/echo.c:1.19	Mon Sep  5 01:00:07 2016
+++ src/bin/echo/echo.c	Wed May 19 22:12:36 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: echo.c,v 1.19 2016/09/05 01:00:07 sevan Exp $	*/
+/* $NetBSD: echo.c,v 1.20 2021/05/19 22:12:36 kre Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -40,10 +40,11 @@ __COPYRIGHT(
 #if 0
 static char sccsid[] = "@(#)echo.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: echo.c,v 1.19 2016/09/05 01:00:07 sevan Exp $");
+__RCSID("$NetBSD: echo.c,v 1.20 2021/05/19 22:12:36 kre Exp $");
 #endif
 #endif /* not lint */
 
+#include <err.h>
 #include <locale.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -75,7 +76,7 @@ main(int argc, char *argv[])
 		(void)putchar('\n');
 	fflush(stdout);
 	if (ferror(stdout))
-		exit(1);
+		err(1, "write error");
 	exit(0);
 	/* NOTREACHED */
 }

Reply via email to