Signed-off-by: Allan McRae <allan@archlinux.org> --- lib/libalpm/be_local.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c index fe9e05a..3d6b8d6 100644 --- a/lib/libalpm/be_local.c +++ b/lib/libalpm/be_local.c @@ -398,9 +398,11 @@ static int local_db_validate(alpm_db_t *db) { struct dirent *ent = NULL; const char *dbpath; + DIR *dbdir; char dbverpath[PATH_MAX]; FILE *dbverfile; - DIR *dbdir; + int t; + size_t version; if(db->status & DB_STATUS_VALID) { return 0; @@ -456,6 +458,15 @@ static int local_db_validate(alpm_db_t *db) goto version_latest; } + t = fscanf(dbverfile, "%zu", &version); + (void)t; + + fclose(dbverfile); + + if(version != ALPM_LOCAL_DB_VERSION) { + goto version_error; + } + version_latest: db->status |= DB_STATUS_VALID; db->status &= ~DB_STATUS_INVALID; -- 1.8.3.3