mirror of
https://github.com/curl/curl.git
synced 2025-01-30 14:22:33 +08:00
tool_metalink.c: Added name of validation hash to messages
This makes it easier to debug broken hashes or hash functions.
This commit is contained in:
parent
7f7e2ea72f
commit
a34197ef77
@ -442,8 +442,8 @@ static int check_hash(const char *filename,
|
|||||||
|
|
||||||
fd = open(filename, flags);
|
fd = open(filename, flags);
|
||||||
if(fd == -1) {
|
if(fd == -1) {
|
||||||
fprintf(error, "Metalink: validating (%s) FAILED (%s)\n", filename,
|
fprintf(error, "Metalink: validating (%s) [%s] FAILED (%s)\n", filename,
|
||||||
strerror(errno));
|
digest_def->hash_name, strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
dctx = Curl_digest_init(digest_def->dparams);
|
dctx = Curl_digest_init(digest_def->dparams);
|
||||||
@ -455,8 +455,8 @@ static int check_hash(const char *filename,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if(len == -1) {
|
else if(len == -1) {
|
||||||
fprintf(error, "Metalink: validating (%s) FAILED (%s)\n", filename,
|
fprintf(error, "Metalink: validating (%s) [%s] FAILED (%s)\n", filename,
|
||||||
strerror(errno));
|
digest_def->hash_name, strerror(errno));
|
||||||
Curl_digest_final(dctx, result);
|
Curl_digest_final(dctx, result);
|
||||||
close(fd);
|
close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
@ -468,10 +468,11 @@ static int check_hash(const char *filename,
|
|||||||
digest_def->dparams->digest_resultlen) == 0;
|
digest_def->dparams->digest_resultlen) == 0;
|
||||||
/* sha*sum style verdict output */
|
/* sha*sum style verdict output */
|
||||||
if(check_ok)
|
if(check_ok)
|
||||||
fprintf(error, "Metalink: validating (%s) OK\n", filename);
|
fprintf(error, "Metalink: validating (%s) [%s] OK\n", filename,
|
||||||
|
digest_def->hash_name);
|
||||||
else
|
else
|
||||||
fprintf(error, "Metalink: validating (%s) FAILED (digest mismatch)\n",
|
fprintf(error, "Metalink: validating (%s) [%s] FAILED (digest mismatch)\n",
|
||||||
filename);
|
filename, digest_def->hash_name);
|
||||||
|
|
||||||
free(result);
|
free(result);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
Loading…
Reference in New Issue
Block a user