diff options
author | Jim Meyering <meyering@redhat.com> | 2009-10-28 10:24:09 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2009-10-28 10:24:09 +0100 |
commit | 119ae5514681e42839f83a4993021a222ec45daa (patch) | |
tree | 738821f33235d41617621e2bbfd928261d762101 | |
parent | 57eaa6500c8afacc43b4dd301e6ff7123ee2fe48 (diff) | |
download | gnulib-119ae5514681e42839f83a4993021a222ec45daa.tar.gz |
fprintftime: avoid a warning about ignored fwrite return value
* lib/strftime.c [FPRINTFTIME]: Include "ignore-value.h".
(cpy) [FPRINTFTIME]: Ignore fwrite failure, even though technically,
that is unsafe.
* modules/fprintftime (Depends-on): Add ignore-value.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | lib/strftime.c | 11 | ||||
-rw-r--r-- | modules/fprintftime | 1 |
3 files changed, 17 insertions, 1 deletions
@@ -1,5 +1,11 @@ 2009-10-28 Jim Meyering <meyering@redhat.com> + fprintftime: avoid a warning about ignored fwrite return value + * lib/strftime.c [FPRINTFTIME]: Include "ignore-value.h". + (cpy) [FPRINTFTIME]: Ignore fwrite failure, even though technically, + that is unsafe. + * modules/fprintftime (Depends-on): Add ignore-value. + exclude: avoid an unwarranted warning * lib/exclude.c (excluded_file_name): Initialize "rc" before switch. diff --git a/lib/strftime.c b/lib/strftime.c index fff5d38eae..7f06d6fda2 100644 --- a/lib/strftime.c +++ b/lib/strftime.c @@ -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), \ diff --git a/modules/fprintftime b/modules/fprintftime index 4333a31374..87598eff18 100644 --- a/modules/fprintftime +++ b/modules/fprintftime @@ -7,6 +7,7 @@ lib/fprintftime.c m4/fprintftime.m4 Depends-on: +ignore-value strftime configure.ac: |