summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2014-01-06 17:52:22 +0100
committerAllan McRae <allan@archlinux.org>2014-01-30 04:45:53 +0100
commit6be08f76f6c4188f0aa4d0a4d88595a898bf3d3b (patch)
treef9ce3ecd32d73703ed1de838516a0dfaec848424 /lib
parent819b4cd54e3caec4d3803cc62772369031ed0847 (diff)
downloadpacman-6be08f76f6c4188f0aa4d0a4d88595a898bf3d3b.tar.gz
pacman-6be08f76f6c4188f0aa4d0a4d88595a898bf3d3b.tar.xz
local_db_populate: initialize empty pkgcache
If the db directory did not exist when local_db_populate was called, the pkgcache wouldn't be initialized, causing pkghash_add_pkg to fail. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/be_local.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c
index d6a7b3c0..0b5b266f 100644
--- a/lib/libalpm/be_local.c
+++ b/lib/libalpm/be_local.c
@@ -459,6 +459,7 @@ static int local_db_populate(alpm_db_t *db)
/* no database existing yet is not an error */
db->status &= ~DB_STATUS_EXISTS;
db->status |= DB_STATUS_MISSING;
+ db->pkgcache = _alpm_pkghash_create(0);
return 0;
}
RET_ERR(db->handle, ALPM_ERR_DB_OPEN, -1);