summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/db.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-08 04:42:47 +0200
committerDan McGee <dan@archlinux.org>2011-06-14 02:41:37 +0200
commit8be4db8caf8e534afe7ebea1eb913b34b2414a43 (patch)
treef3f9da73b79231e481535bb43cbb7abb2fd1f63f /lib/libalpm/db.c
parentf6700d5c9830cc2493d8448bd7af8ab7d649e8e6 (diff)
downloadpacman-8be4db8caf8e534afe7ebea1eb913b34b2414a43.tar.gz
pacman-8be4db8caf8e534afe7ebea1eb913b34b2414a43.tar.xz
Add a helper method for retrieving the DB signature path
Note that is a bit different than the normal _alpm_db_path() method; the caller is expected to free the result. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/db.c')
-rw-r--r--lib/libalpm/db.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index 8ffd17ef..5b272eac 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -379,6 +379,20 @@ int _alpm_db_version(pmdb_t *db)
return db->ops->version(db);
}
+char *_alpm_db_sig_path(pmdb_t *db)
+{
+ char *sigpath;
+ size_t len;
+ const char *dbfile = _alpm_db_path(db);
+ if(!db || !dbfile) {
+ return NULL;
+ }
+ len = strlen(dbfile) + strlen(".sig") + 1;
+ CALLOC(sigpath, len, sizeof(char), RET_ERR(db->handle, PM_ERR_MEMORY, NULL));
+ sprintf(sigpath, "%s.sig", dbfile);
+ return sigpath;
+}
+
int _alpm_db_cmp(const void *d1, const void *d2)
{
pmdb_t *db1 = (pmdb_t *)d1;