diff options
author | ewt <devnull@localhost> | 1999-01-04 16:44:52 +0000 |
---|---|---|
committer | ewt <devnull@localhost> | 1999-01-04 16:44:52 +0000 |
commit | c4567f6371f37c82004d5425278d8f4c3ae85c38 (patch) | |
tree | dfda8d275a34beed36c0cb587c32dff2599c511b /lib | |
parent | fcfce2db40da497ebd1d7f169eefe44a48884cc0 (diff) | |
download | librpm-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.c | 14 |
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); |