]> git.sur5r.net Git - u-boot/blobdiff - tools/envcrc.c
README: Update the list of directories.
[u-boot] / tools / envcrc.c
index 5b0f7cd4ec5bb01d7d641d232b2d1c63a90cd92a..c8c50d71962456e21724f68c733e2e863ff41fb9 100644 (file)
@@ -21,6 +21,7 @@
  * MA 02111-1307 USA
  */
 
+#include <errno.h>
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
@@ -121,7 +122,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),