libxbps: ABI/API break due to hash function changes

This commit is contained in:
Duncan Overbruck
2020-02-10 01:54:52 +01:00
parent aa4d726dca
commit 0d90534236
18 changed files with 141 additions and 118 deletions

View File

@@ -69,7 +69,7 @@ xbps_entry_install_conf_file(struct xbps_handle *xhp,
xbps_object_t obj, obj2;
xbps_object_iterator_t iter, iter2;
const char *version = NULL, *cffile, *sha256_new = NULL;
char buf[PATH_MAX], *sha256_cur = NULL, *sha256_orig = NULL;
char buf[PATH_MAX], sha256_cur[XBPS_SHA256_SIZE], *sha256_orig = NULL;
int rv = 0;
assert(xbps_object_type(binpkg_filesd) == XBPS_TYPE_DICTIONARY);
@@ -139,9 +139,7 @@ xbps_entry_install_conf_file(struct xbps_handle *xhp,
if (strcmp(entry_pname, buf)) {
continue;
}
sha256_cur = xbps_file_hash(buf);
xbps_dictionary_get_cstring_nocopy(obj, "sha256", &sha256_new);
if (sha256_cur == NULL) {
if (!xbps_file_sha256(sha256_cur, sizeof sha256_cur, buf)) {
if (errno == ENOENT) {
/*
* File not installed, install new one.
@@ -155,6 +153,7 @@ xbps_entry_install_conf_file(struct xbps_handle *xhp,
break;
}
}
xbps_dictionary_get_cstring_nocopy(obj, "sha256", &sha256_new);
/*
* Orig = X, Curr = X, New = X
*
@@ -232,15 +231,11 @@ xbps_entry_install_conf_file(struct xbps_handle *xhp,
rv = 1;
break;
}
free(sha256_cur);
sha256_cur = NULL;
}
out:
if (sha256_orig)
free(sha256_orig);
if (sha256_cur)
free(sha256_cur);
xbps_object_iterator_release(iter);