changeset 17270:8b492e35b987

fprintftime: bring back and reword fwrite comment * lib/strftime.c (cpy) [FPRINTFTIME]: Re-add reworded comment.
author Paul Eggert <eggert@cs.ucla.edu>
date Fri, 04 Jan 2013 13:21:48 -0800
parents 2c9278655224
children a9accc6ede49
files ChangeLog lib/strftime.c
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2013-01-04  Paul Eggert  <eggert@cs.ucla.edu>
 
+	fprintftime: bring back and reword fwrite comment
+	* lib/strftime.c (cpy) [FPRINTFTIME]: Re-add reworded comment.
+
 	stdio: remove now-unnecessary stdio.c
 	Since stdio.in.h no longer uses inline functions, we no longer
 	need to compile the extern versions.
--- a/lib/strftime.c
+++ b/lib/strftime.c
@@ -208,7 +208,14 @@
          else if (to_uppcase)                                                 \
            fwrite_uppcase (p, (s), _n);                                       \
          else                                                                 \
-           fwrite (s, _n, 1, p);                                              \
+           {                                                                  \
+             /* Ignore the value of fwrite.  The caller can determine whether \
+                an error occured by inspecting ferror (P).  All known fwrite  \
+                implementations set the stream's error indicator when they    \
+                fail due to ENOMEM etc., even though C11 and POSIX.1-2008 do  \
+                not require this.  */                                         \
+             fwrite (s, _n, 1, p);                                            \
+           }                                                                  \
        }                                                                      \
      while (0)                                                                \
     )