db: fix regression in creating .apk-new files
The apk_fsdir_file_digest() servers dual purpose: to calculate the checksum, but also to determine if the file exists. Move it's error check where it originally was. fixes #10791cute-signatures
parent
83b71f0baf
commit
cce6239074
|
@ -241,7 +241,9 @@ void apk_name_foreach_matching(struct apk_database *db, struct apk_string_array
|
|||
|
||||
static inline uint8_t apk_dbf_digest(struct apk_db_file *dbf)
|
||||
{
|
||||
uint8_t alg = apk_digest_alg_by_len(dbf->csum.type);
|
||||
uint8_t alg;
|
||||
if (!dbf) return APK_DIGEST_NONE;
|
||||
alg = apk_digest_alg_by_len(dbf->csum.type);
|
||||
if (alg == APK_DIGEST_SHA1 && dbf->diri->pkg->ipkg->sha256_160)
|
||||
alg = APK_DIGEST_SHA256_160;
|
||||
return alg;
|
||||
|
|
|
@ -2658,10 +2658,10 @@ static void apk_db_migrate_files(struct apk_database *db,
|
|||
if (ofile && ofile->diri->pkg->name == NULL) {
|
||||
// File was from overlay, delete the package's version
|
||||
ctrl = APK_FS_CTRL_CANCEL;
|
||||
} else if ((diri->dir->protect_mode != APK_PROTECT_NONE) &&
|
||||
} else if (diri->dir->protect_mode != APK_PROTECT_NONE &&
|
||||
apk_fsdir_file_digest(&d, key.filename, apk_dbf_digest(ofile), &dgst) == 0 &&
|
||||
(!ofile || ofile->csum.type == APK_CHECKSUM_NONE ||
|
||||
(apk_fsdir_file_digest(&d, key.filename, apk_dbf_digest(ofile), &dgst) == 0 &&
|
||||
apk_digest_cmp_csum(&dgst, &ofile->csum) != 0))) {
|
||||
apk_digest_cmp_csum(&dgst, &ofile->csum) != 0)) {
|
||||
// Protected directory, and a file without db entry
|
||||
// or with local modifications. Keep the filesystem file.
|
||||
// Determine if the package's file should be kept as .apk-new
|
||||
|
|
Loading…
Reference in New Issue