X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fstrftime.c;h=7d64c15264634bf6df2eea42aa0a34b3af14711d;hb=964a52336aad0cf4a4d6c08c128560c87742c921;hp=fff5d38eaeca6ce298e8d1f03431713a17bfb654;hpb=e97e3a48d3a23446cf334e288aa6f138a6f9bae5;p=gnulib.git diff --git a/lib/strftime.c b/lib/strftime.c index fff5d38ea..7d64c1526 100644 --- a/lib/strftime.c +++ b/lib/strftime.c @@ -31,6 +31,7 @@ # else # include "strftime.h" # endif +# include "ignore-value.h" #endif #include @@ -198,12 +199,25 @@ extern char *tzname[]; #if FPRINTFTIME # define cpy(n, s) \ add ((n), \ + do \ + { \ if (to_lowcase) \ fwrite_lowcase (p, (s), _n); \ 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)); \ + } \ + } \ + while (0) \ + ) #else # define cpy(n, s) \ add ((n), \