summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-10-18 20:43:14 -0400
committerWolfgang Denk <wd@denx.de>2009-10-19 10:36:31 +0200
commitf67066b6b0740b826ed862615c5ab022aaf4779a (patch)
tree87a3430d98c037866660dfadae52392261905b6c
parentefd988ebaa241bab265b1511052350207cb7aaa0 (diff)
downloadu-boot-imx-f67066b6b0740b826ed862615c5ab022aaf4779a.zip
u-boot-imx-f67066b6b0740b826ed862615c5ab022aaf4779a.tar.gz
u-boot-imx-f67066b6b0740b826ed862615c5ab022aaf4779a.tar.bz2
envcrc: check return value of fwrite()
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 <vapier@gentoo.org>
-rw-r--r--tools/envcrc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/envcrc.c b/tools/envcrc.c
index d02a7db..d1e84b3 100644
--- a/tools/envcrc.c
+++ b/tools/envcrc.c
@@ -21,6 +21,7 @@
* MA 02111-1307 USA
*/
+#include <errno.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
@@ -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),