diff options
author | jbj <devnull@localhost> | 2004-11-11 03:58:46 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2004-11-11 03:58:46 +0000 |
commit | 8ce559b875c401630120a251cc73b23012f45080 (patch) | |
tree | 916aee4d6620d6dd8f1a8a0be5195698876dd239 /rpmdb | |
parent | 13b145b6af842a268d99a6a64fcf4e416ee4e681 (diff) | |
download | librpm-tizen-8ce559b875c401630120a251cc73b23012f45080.tar.gz librpm-tizen-8ce559b875c401630120a251cc73b23012f45080.tar.bz2 librpm-tizen-8ce559b875c401630120a251cc73b23012f45080.zip |
Avoid unnecessary chroot("/") calls for certain Mac OSX kernels.
Strip URL clutter from --root paths in rpmtsRootDir(ts) and newRpmdb().
CVS patchset: 7574
CVS date: 2004/11/11 03:58:46
Diffstat (limited to 'rpmdb')
-rw-r--r-- | rpmdb/rpmdb.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/rpmdb/rpmdb.c b/rpmdb/rpmdb.c index 58b980b91..22b7f1afa 100644 --- a/rpmdb/rpmdb.c +++ b/rpmdb/rpmdb.c @@ -917,10 +917,28 @@ rpmdb newRpmdb(/*@kept@*/ /*@null@*/ const char * root, if (perms >= 0) db->db_perms = perms; if (flags >= 0) db->db_flags = flags; - /*@-nullpass@*/ - db->db_root = rpmGetPath( (root && *root ? root : _DB_ROOT), NULL); +/*@-nullpass@*/ + /* HACK: no URL's for root prefixed dbpath yet. */ + if (root && *root) { + const char * rootpath = NULL; + urltype ut = urlPath(root, &rootpath); + switch (ut) { + case URL_IS_PATH: + case URL_IS_UNKNOWN: + db->db_root = rpmGetPath(root, NULL); + break; + case URL_IS_HTTPS: + case URL_IS_HTTP: + case URL_IS_FTP: + case URL_IS_DASH: + default: + db->db_root = rpmGetPath(_DB_ROOT, NULL); + break; + } + } else + db->db_root = rpmGetPath(_DB_ROOT, NULL); db->db_home = rpmGetPath( (home && *home ? home : _DB_HOME), NULL); - /*@=nullpass@*/ +/*@=nullpass@*/ if (!(db->db_home && db->db_home[0] != '%')) { rpmError(RPMERR_DBOPEN, _("no dbpath has been set\n")); db->db_root = _free(db->db_root); |