uninstalls need to handle shared config files properly
authorewt <devnull@localhost>
Sun, 7 Feb 1999 16:44:21 +0000 (16:44 +0000)
committerewt <devnull@localhost>
Sun, 7 Feb 1999 16:44:21 +0000 (16:44 +0000)
CVS patchset: 2779
CVS date: 1999/02/07 16:44:21

lib/transaction.c

index 5b69961..b7cc07a 100644 (file)
@@ -872,7 +872,7 @@ static int handleRmvdInstalledFiles(struct fileInfo * fi, rpmdb db,
 void handleOverlappedFiles(struct fileInfo * fi, hashTable ht,
                             rpmProblemSet probs) {
     int i, j;
-    struct fileInfo ** recs;
+    struct fileInfo ** recs, * otherRec = NULL;
     int numRecs;
     int otherPkgNum, otherFileNum;
     struct stat sb;
@@ -898,13 +898,15 @@ void handleOverlappedFiles(struct fileInfo * fi, hashTable ht,
                                 recs[otherPkgNum]->fps[otherFileNum])) 
                        break;
                if ((otherFileNum >= 0) && 
-                   (recs[otherPkgNum]->actions[otherFileNum] == CREATE))
+                   (recs[otherPkgNum]->actions[otherFileNum] != UNKNOWN)) {
+                   otherRec = recs[otherPkgNum];
                    break;
+               }
            }
            otherPkgNum--;
        }
 
-       if (fi->type == ADDED && otherPkgNum < 0) {
+       if (fi->type == ADDED && !otherRec) {
            /* If it isn't in the database, install it. 
               FIXME: check for config files here for .rpmorig purporses! */
            if (fi->actions[i] == UNKNOWN) {
@@ -915,22 +917,22 @@ void handleOverlappedFiles(struct fileInfo * fi, hashTable ht,
                    fi->actions[i] = CREATE;
            }
        } else if (fi->type == ADDED) {
-           if (filecmp(recs[otherPkgNum]->fmodes[otherFileNum],
-                       recs[otherPkgNum]->fmd5s[otherFileNum],
-                       recs[otherPkgNum]->flinks[otherFileNum],
+           if (filecmp(otherRec->fmodes[otherFileNum],
+                       otherRec->fmd5s[otherFileNum],
+                       otherRec->flinks[otherFileNum],
                        fi->fmodes[i],
                        fi->fmd5s[i],
                        fi->flinks[i])) {
                psAppend(probs, RPMPROB_NEW_FILE_CONFLICT, fi->ap->key, 
-                        fi->ap->h, fi->fl[i], recs[otherPkgNum]->ap->h);
+                        fi->ap->h, fi->fl[i], otherRec->ap->h);
            }
 
            /* FIXME: is this right??? it locks us into the config
               file handling choice we already made, which may very
               well be exactly right. */
-           fi->actions[i] = recs[otherPkgNum]->actions[otherFileNum];
+           fi->actions[i] = otherRec->actions[otherFileNum];
            recs[otherPkgNum]->actions[otherFileNum] = SKIP;
-       } else if (fi->type == REMOVED && otherPkgNum >= 0) {
+       } else if (fi->type == REMOVED && otherRec) {
            fi->actions[i] = SKIP;
        } else if (fi->type == REMOVED) {
            if (fi->actions[i] != SKIP && fi->actions[i] != SKIPNSTATE &&