From fbe424f202b32a42bed599739a687ce5bfebe92f Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 12 Apr 2012 17:27:24 +0300 Subject: [PATCH] Further tweak the config file removal/backup logic to make it clearer - Turn the strange negated condition around: when dealing with config files test for it directly. This way, all the special cases are handled first and normal cases fall through the if-jungle to exactly one case of rpmfsSetAction(fs, i, FA_ERASE). Makes the logic more obvious, at least to me. --- lib/transaction.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/transaction.c b/lib/transaction.c index 86b2d13..4e89651 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -527,13 +527,10 @@ assert(otherFi != NULL); break; if (rpmfiFState(fi) != RPMFILE_STATE_NORMAL) break; - if (!(S_ISREG(FMode) && (FFlags & RPMFILE_CONFIG))) { - rpmfsSetAction(fs, i, FA_ERASE); - break; - } - /* Here is a pre-existing modified config file that needs saving. */ - { int algo = 0; + /* 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 = rpmfiFDigest(fi, &algo, &diglen))) { @@ -547,6 +544,8 @@ assert(otherFi != NULL); } } } + + /* Otherwise, we can just erase. */ rpmfsSetAction(fs, i, FA_ERASE); break; } -- 2.7.4