diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2012-08-22 11:56:12 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2012-08-22 11:56:12 +0300 |
commit | a3a08a4b0aa96ae03c33050920baf894cc706c9e (patch) | |
tree | 0b05839e18951a6450b8f95fffa24a93890feacf /lib/transaction.c | |
parent | 79f8122f41116659e944feb6675725d09663a0dd (diff) | |
download | rpm-a3a08a4b0aa96ae03c33050920baf894cc706c9e.tar.gz rpm-a3a08a4b0aa96ae03c33050920baf894cc706c9e.tar.bz2 rpm-a3a08a4b0aa96ae03c33050920baf894cc706c9e.zip |
Use rpmfiConfigConflictIndex() for modified config testing on erase too
- Besides eliminating another copy-paste variant of the config file
digest calculation and comparison, this fixes the case modified
%config symlink gets silently erased. Unlike a regular config file,
a symlink does not contain a whole lot of carefully tuned data, but
if it's marked %config I think we should honor the %config file rules.
- Adjust test-suite expectations to match the new behavior.
Diffstat (limited to 'lib/transaction.c')
-rw-r--r-- | lib/transaction.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/lib/transaction.c b/lib/transaction.c index 80e7e3d2c..c0653ba30 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -544,21 +544,9 @@ assert(otherFi != NULL); break; /* Pre-existing modified config files need to be saved. */ - if (S_ISREG(FMode) && (FFlags & RPMFILE_CONFIG)) { - int algo = 0; - size_t diglen = 0; - const unsigned char *digest; - if ((digest = rpmfiFDigestIndex(fi, i, &algo, &diglen))) { - unsigned char fdigest[diglen]; - char *fn = rpmfiFNIndex(fi, i); - int modified = (!rpmDoDigest(algo, fn, 0, fdigest, NULL) && - memcmp(digest, fdigest, diglen)); - free(fn); - if (modified) { - rpmfsSetAction(fs, i, FA_BACKUP); - break; - } - } + if (rpmfiConfigConflictIndex(fi, i)) { + rpmfsSetAction(fs, i, FA_BACKUP); + break; } /* Otherwise, we can just erase. */ |