From f67066b6b0740b826ed862615c5ab022aaf4779a Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 18 Oct 2009 20:43:14 -0400 Subject: [PATCH] envcrc: check return value of fwrite() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Newer toolchains will often complain about unchecked fwrite(): envcrc.c:117: warning: ignoring return value of `fwrite´, declared with attribute warn_unused_result So check the return value to silence the warnings. Signed-off-by: Mike Frysinger --- tools/envcrc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/envcrc.c b/tools/envcrc.c index d02a7dbcdc..d1e84b3b63 100644 --- a/tools/envcrc.c +++ b/tools/envcrc.c @@ -21,6 +21,7 @@ * MA 02111-1307 USA */ +#include #include #include #include @@ -114,7 +115,8 @@ int main (int argc, char **argv) } for (i = start; i != end; i += step) printf("%c", (crc & (0xFF << (i * 8))) >> (i * 8)); - fwrite(dataptr, 1, datasize, stdout); + if (fwrite(dataptr, 1, datasize, stdout) != datasize) + fprintf(stderr, "fwrite() failed: %s\n", strerror(errno)); } else { printf("CRC32 from offset %08X to %08X of environment = %08X\n", (unsigned int) (dataptr - envptr), -- 2.25.1