aboutsummaryrefslogtreecommitdiffstats
path: root/package/system
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2015-03-05 20:25:02 +0000
committerJohn Crispin <blogic@openwrt.org>2015-03-05 20:25:02 +0000
commit8a9f7fdf7da603a32df35ae86732d0604a2db6bc (patch)
tree42f329a2e1aae454b5bbcaac2a19954550417343 /package/system
parentd7a6866ce070851dd0aedbe0c0cac4ed550615c8 (diff)
downloadupstream-8a9f7fdf7da603a32df35ae86732d0604a2db6bc.tar.gz
upstream-8a9f7fdf7da603a32df35ae86732d0604a2db6bc.tar.bz2
upstream-8a9f7fdf7da603a32df35ae86732d0604a2db6bc.zip
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 <zefir.kurtisi@neratec.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@44605 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/system')
-rw-r--r--package/system/mtd/src/mtd.c2
1 files changed, 1 insertions, 1 deletions
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;
}