diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2012-08-21 14:52:06 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2012-08-21 15:54:38 +0300 |
commit | 79f8122f41116659e944feb6675725d09663a0dd (patch) | |
tree | 9142fd53a0e44c60e9df58a87f775efe18161477 /lib/rpmfi.c | |
parent | 9f9ed70e2d85b0e8f5e2d9cf9969046034d9ad31 (diff) | |
download | librpm-tizen-79f8122f41116659e944feb6675725d09663a0dd.tar.gz librpm-tizen-79f8122f41116659e944feb6675725d09663a0dd.tar.bz2 librpm-tizen-79f8122f41116659e944feb6675725d09663a0dd.zip |
Polish the symlink config file comparison a bit
- Similar treatment as in commit 9f9ed70e2d85b0e8f5e2d9cf9969046034d9ad31,
pay more attention to what kind of files we're comparing in each case,
add a little breathing room and extra comments.
- Handle the case where on-disk link is identical to the one in new
package in which case no backup will be needed, fixing two cases
of unwanted backups in the test-suite.
(similar to commit 7a50e9de80ab3c47618dad1e9a5b2d9b79bfc8dc)
- Other than the on-disk vs new package change, probably doesn't change
anything yet, but prepares us for the next steps.
Diffstat (limited to 'lib/rpmfi.c')
-rw-r--r-- | lib/rpmfi.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/rpmfi.c b/lib/rpmfi.c index b069cdd3c..ea1769650 100644 --- a/lib/rpmfi.c +++ b/lib/rpmfi.c @@ -664,8 +664,10 @@ rpmFileAction rpmfiDecideFateIndex(rpmfi ofi, int oix, rpmfi nfi, int nix, } /* ...but otherwise a backup will be needed */ - } else /* dbWhat == LINK */ { + } else if (dbWhat == LINK) { const char * oFLink, * nFLink; + + /* See if the link on disk is identical to the one in old pkg */ oFLink = rpmfiFLinkIndex(ofi, oix); if (diskWhat == LINK) { ssize_t link_len = readlink(fn, buffer, sizeof(buffer) - 1); @@ -675,9 +677,19 @@ rpmFileAction rpmfiDecideFateIndex(rpmfi ofi, int oix, rpmfi nfi, int nix, if (oFLink && rstreq(oFLink, buffer)) return FA_CREATE; /* unmodified config file, replace. */ } + + /* See if the link on disk is identical to the one in new pkg */ nFLink = rpmfiFLinkIndex(nfi, nix); - if (oFLink && nFLink && rstreq(oFLink, nFLink)) + if (diskWhat == LINK && newWhat == LINK) { + if (nFLink && rstreq(nFLink, buffer)) + return FA_CREATE; /* unmodified config file, replace. */ + } + + /* If link is identical in old and new pkg, let it be */ + if (newWhat == LINK && oFLink && nFLink && rstreq(oFLink, nFLink)) return FA_SKIP; /* identical file, don't bother. */ + + /* ...but otherwise a backup will be needed */ } /* |