Skip to content

Commit 472c132

Browse files
committed
lib/transaction_fetch.c: better error message for checksum mismatch
1 parent 73f8835 commit 472c132

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/transaction_fetch.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,16 @@ verify_binpkg(struct xbps_handle *xhp, xbps_dictionary_t pkgd)
8181
"%s: verifying SHA256 hash...", pkgver);
8282
xbps_dictionary_get_cstring_nocopy(pkgd, "filename-sha256", &sha256);
8383
if ((rv = xbps_file_sha256_check(binfile, sha256)) != 0) {
84-
xbps_set_cb_state(xhp, XBPS_STATE_VERIFY_FAIL, rv, pkgver,
85-
"%s: SHA256 hash is not valid: %s", pkgver, strerror(rv));
84+
if (rv == ERANGE) {
85+
xbps_set_cb_state(xhp, XBPS_STATE_VERIFY_FAIL,
86+
rv, pkgver,
87+
"%s: checksum does not match repository index",
88+
pkgver);
89+
} else {
90+
xbps_set_cb_state(xhp, XBPS_STATE_VERIFY_FAIL,
91+
rv, pkgver, "%s: failed to checksum: %s",
92+
pkgver, strerror(errno));
93+
}
8694
return rv;
8795
}
8896

0 commit comments

Comments
 (0)