From 12b921284d210c13091b176fdbb0bc6fd2adc461 Mon Sep 17 00:00:00 2001 From: ewt Date: Sun, 21 Feb 1999 04:01:12 +0000 Subject: [PATCH] fixed relocated/excluded paths CVS patchset: 2822 CVS date: 1999/02/21 04:01:12 --- lib/transaction.c | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/lib/transaction.c b/lib/transaction.c index 6fc6a9d..28df01a 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -468,7 +468,7 @@ static Header relocateFileList(struct availablePackage * alp, char ** validRelocations, ** actualRelocations; char ** names; char ** origNames; - int len, newLen; + int len; char * newName; int_32 fileCount; Header h; @@ -559,28 +559,20 @@ static Header relocateFileList(struct availablePackage * alp, /* go through things backwards so that /usr/local relocations take precedence over /usr ones */ - nextReloc = relocations + numRelocations - 1; - len = strlen(nextReloc->oldPath); - newLen = nextReloc->newPath ? strlen(nextReloc->newPath) : 0; - for (i = fileCount - 1; i >= 0 && nextReloc; i--) { - do { - rc = (!strncmp(nextReloc->oldPath, names[i], len) && - (names[i][len] == '/')); - if (!rc) { - if (nextReloc == relocations) { - nextReloc = 0; - } else { - nextReloc--; - len = strlen(nextReloc->oldPath); - newLen = nextReloc->newPath ? - strlen(nextReloc->newPath) : 0; - } - } - } while (!rc && nextReloc); + for (i = fileCount - 1; i >= 0; i--) { + for (j = numRelocations - 1; j >= 0; j--) { + nextReloc = relocations + j; + len = strlen(relocations[j].oldPath); + rc = (!strncmp(relocations[j].oldPath, names[i], len) && + ((names[i][len] == '/') || !names[i][len])); + if (rc) break; + } - if (rc) { + if (j >= 0) { + nextReloc = relocations + j; if (nextReloc->newPath) { - newName = alloca(newLen + strlen(names[i]) + 1); + newName = alloca(strlen(nextReloc->newPath) + + strlen(names[i]) + 1); strcpy(newName, nextReloc->newPath); strcat(newName, names[i] + len); rpmMessage(RPMMESS_DEBUG, _("relocating %s to %s\n"), -- 2.7.4