From: John Crispin Date: Thu, 5 Mar 2015 20:25:02 +0000 (+0000) Subject: mtd: fix md5sum error checking X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=6cea48afe6b2a6578c9aa20ee45a642cd86d1c66;p=openwrt%2Fsvn-archive%2Farchive.git mtd: fix md5sum error checking In mtd_verify(), the return value of md5sum() has been interpreted as error if nonzero, while the function returns number of processed bytes, which caused mtd_verify() to always fail. This patch fixes error checking to interpret only negative values as errors. Signed-off-by: Zefir Kurtisi SVN-Revision: 44605 --- diff --git a/package/system/mtd/src/mtd.c b/package/system/mtd/src/mtd.c index 72b9ddfe21..741b57b480 100644 --- a/package/system/mtd/src/mtd.c +++ b/package/system/mtd/src/mtd.c @@ -337,7 +337,7 @@ mtd_verify(const char *mtd, char *file) if (quiet < 2) fprintf(stderr, "Verifying %s against %s ...\n", mtd, file); - if (stat(file, &s) || md5sum(file, f_md5)) { + if (stat(file, &s) || md5sum(file, f_md5) < 0) { fprintf(stderr, "Failed to hash %s\n", file); return -1; }