From c17b5493c19628fe6af906f3a18264fef7252023 Mon Sep 17 00:00:00 2001 From: ewt Date: Fri, 29 Mar 1996 20:51:20 +0000 Subject: [PATCH] doesn't remove files that were never installed (RPMFILE_STATE_NOTINSTALLED) CVS patchset: 507 CVS date: 1996/03/29 20:51:20 --- lib/uninstall.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/uninstall.c b/lib/uninstall.c index 083ea52..5877f35 100644 --- a/lib/uninstall.c +++ b/lib/uninstall.c @@ -149,6 +149,10 @@ static int handleSharedFiles(rpmdb db, int offset, char ** fileList, case RPMFILE_STATE_REPLACED: message(MESS_DEBUG, " file has already been replaced\n"); break; + + case RPMFILE_STATE_NOTINSTALLED: + message(MESS_DEBUG, " file was never installed\n"); + break; case RPMFILE_STATE_NORMAL: if (!strcmp(fileMd5List[sharedList[i].mainFileNumber], @@ -213,9 +217,6 @@ int rpmRemovePackage(char * prefix, rpmdb db, unsigned int offset, int test) { fnbuffer = alloca(fnbuffersize); } - fileActions = alloca(sizeof(*fileActions) * fileCount); - for (i = 0; i < fileCount; i++) fileActions[i] = REMOVE; - getEntry(h, RPMTAG_FILESTATES, &type, (void **) &fileStatesList, &fileCount); getEntry(h, RPMTAG_FILEMD5S, &type, (void **) &fileMd5List, @@ -225,6 +226,13 @@ int rpmRemovePackage(char * prefix, rpmdb db, unsigned int offset, int test) { getEntry(h, RPMTAG_FILEMODES, &type, (void **) &fileModesList, &fileCount); + fileActions = alloca(sizeof(*fileActions) * fileCount); + for (i = 0; i < fileCount; i++) + if (fileStatesList[i] == RPMFILE_STATE_NOTINSTALLED) + fileActions[i] = KEEP; + else + fileActions[i] = REMOVE; + handleSharedFiles(db, offset, fileList, fileMd5List, fileCount, fileActions); /* go through the filelist backwards to help insure that rmdir() -- 2.7.4