aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2025-11-03 13:00:32 +0000
committerPádraig Brady <P@draigBrady.com>2025-11-03 13:00:32 +0000
commitcb0ab4ef394c37c4f874f150db7f75f3ba617dd4 (patch)
tree5c7eb32be37be0401af6d4d712b770e8644a5cdb
parentdate: translate/clarify recent error message (diff)
downloadcoreutils-cb0ab4ef394c37c4f874f150db7f75f3ba617dd4.tar.gz
coreutils-cb0ab4ef394c37c4f874f150db7f75f3ba617dd4.zip
date: avoid a duplicated write error diagnotic
* src/show-date.c (show_date): Only show the fprintftime() diagnostic if a further diagnostic will not be shown.
-rw-r--r--src/show-date.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/show-date.c b/src/show-date.c
index 96cefc810..ff1470e8e 100644
--- a/src/show-date.c
+++ b/src/show-date.c
@@ -31,7 +31,8 @@ show_date (char const *format, struct timespec when, timezone_t tz)
if (fprintftime (stdout, format, &tm, tz, when.tv_nsec) < 0)
{
- error (0, errno, _("fprintftime error"));
+ if (! ferror (stdout)) /* otherwise it will be diagnosed later. */
+ error (0, errno, _("fprintftime error"));
return false;
}