[pacman-dev] [PATCH 3/8] local_db_populate: initialize empty pkgcache

Andrew Gregory andrew.gregory.8 at gmail.com
Mon Jan 6 11:52:22 EST 2014


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 at gmail.com>
---
 lib/libalpm/be_local.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c
index 6029e12..671eed1 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);
-- 
1.8.5.2



More information about the pacman-dev mailing list