summaryrefslogtreecommitdiff
path: root/lib/libalpm/db.c
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2015-07-14 21:45:59 +1000
committerAllan McRae <allan@archlinux.org>2015-07-15 10:57:29 +1000
commitf6c55b3c3f395839c0973c36b7a7e05984636a61 (patch)
tree16d85d4e4fca3bb8249a58f4b93f9088d6f5df55 /lib/libalpm/db.c
parent1ada16f0177f9bfcaed95cf3b71b7029290a5f1d (diff)
downloadpacman-f6c55b3c3f395839c0973c36b7a7e05984636a61.tar.xz
Allow frontends to specify the sync database extension
This allows frontends to select between the .db and .files databases currently supplied by repo-add or any other compatible database. Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm/db.c')
-rw-r--r--lib/libalpm/db.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index fe208be0..b94d3342 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -375,10 +375,12 @@ const char *_alpm_db_path(alpm_db_t *db)
CALLOC(db->_path, 1, pathsize, RET_ERR(db->handle, ALPM_ERR_MEMORY, NULL));
sprintf(db->_path, "%s%s/", dbpath, db->treename);
} else {
- pathsize = strlen(dbpath) + 5 + strlen(db->treename) + 4;
+ const char *dbext = db->handle->dbext;
+
+ pathsize = strlen(dbpath) + 5 + strlen(db->treename) + strlen(dbext) + 1;
CALLOC(db->_path, 1, pathsize, RET_ERR(db->handle, ALPM_ERR_MEMORY, NULL));
/* all sync DBs now reside in the sync/ subdir of the dbpath */
- sprintf(db->_path, "%ssync/%s.db", dbpath, db->treename);
+ sprintf(db->_path, "%ssync/%s%s", dbpath, db->treename, dbext);
}
_alpm_log(db->handle, ALPM_LOG_DEBUG, "database path for tree %s set to %s\n",
db->treename, db->_path);