summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorewt <devnull@localhost>1999-01-04 16:44:52 +0000
committerewt <devnull@localhost>1999-01-04 16:44:52 +0000
commitc4567f6371f37c82004d5425278d8f4c3ae85c38 (patch)
treedfda8d275a34beed36c0cb587c32dff2599c511b /lib
parentfcfce2db40da497ebd1d7f169eefe44a48884cc0 (diff)
downloadlibrpm-tizen-c4567f6371f37c82004d5425278d8f4c3ae85c38.tar.gz
librpm-tizen-c4567f6371f37c82004d5425278d8f4c3ae85c38.tar.bz2
librpm-tizen-c4567f6371f37c82004d5425278d8f4c3ae85c38.zip
canonicalize the root directory
CVS patchset: 2647 CVS date: 1999/01/04 16:44:52
Diffstat (limited to 'lib')
-rw-r--r--lib/depends.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/depends.c b/lib/depends.c
index 660622abd..e5e1d5ef8 100644
--- a/lib/depends.c
+++ b/lib/depends.c
@@ -196,6 +196,7 @@ int intcmp(const void * a, const void *b) {
rpmTransactionSet rpmtransCreateSet(rpmdb db, char * root) {
rpmTransactionSet rpmdep;
+ int rootLength;
rpmdep = malloc(sizeof(*rpmdep));
rpmdep->db = db;
@@ -203,6 +204,19 @@ rpmTransactionSet rpmtransCreateSet(rpmdb db, char * root) {
rpmdep->allocedRemovedPackages = 5;
rpmdep->removedPackages = malloc(sizeof(int) *
rpmdep->allocedRemovedPackages);
+
+ /* This canonicalizes the root */
+ rootLength = strlen(root);
+ if (root && root[rootLength] == '/') {
+ char * newRootdir;
+
+ newRootdir = alloca(rootLength + 2);
+ strcpy(newRootdir, root);
+ newRootdir[rootLength++] = '/';
+ newRootdir[rootLength] = '\0';
+ root = newRootdir;
+ }
+
rpmdep->root = strdup(root);
alCreate(&rpmdep->addedPackages);