fprintftime: avoid a warning about ignored fwrite return value
[gnulib.git] / lib / strftime.c
index fff5d38..7f06d6f 100644 (file)
@@ -31,6 +31,7 @@
 # else
 #  include "strftime.h"
 # endif
+# include "ignore-value.h"
 #endif
 
 #include <ctype.h>
@@ -203,7 +204,15 @@ extern char *tzname[];
         else if (to_uppcase)                                                 \
           fwrite_uppcase (p, (s), _n);                                       \
         else                                                                 \
-          fwrite ((s), _n, 1, p))
+          {                                                                  \
+            /* We are ignoring the value of fwrite here, in spite of the     \
+               fact that technically, that may not be valid: the fwrite      \
+               specification in POSIX 2008 defers to that of fputc, which    \
+               is intended to be consistent with the one from ISO C,         \
+               which permits failure due to ENOMEM *without* setting the     \
+               stream's error indicator.  */                                 \
+            ignore_value (fwrite ((s), _n, 1, p)));                          \
+          }
 #else
 # define cpy(n, s)                                                           \
     add ((n),                                                                \