1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

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>
This commit is contained in:
Dan McGee 2011-06-07 21:42:47 -05:00
parent f6700d5c98
commit 8be4db8caf
2 changed files with 15 additions and 0 deletions

View File

@ -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;

View File

@ -72,6 +72,7 @@ struct __pmdb_t {
pmdb_t *_alpm_db_new(const char *treename, int is_local);
void _alpm_db_free(pmdb_t *db);
const char *_alpm_db_path(pmdb_t *db);
char *_alpm_db_sig_path(pmdb_t *db);
int _alpm_db_version(pmdb_t *db);
int _alpm_db_cmp(const void *d1, const void *d2);
alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles);