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>

SVN-Revision: 44605
v19.07.3_mercusys_ac12_duma
John Crispin 9 years ago
parent f1625b116f
commit b48b7a7689

@ -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;
}

Loading…
Cancel
Save