libsolv/0001-fall-back-to-DB_PRIVATE-on-DB_VERSION_MISMATCH.patch

32 lines
1000 B
Diff

From a7adb20f24a3acc4cd300b9fb12e07ee3dcfb8e3 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Tue, 19 Sep 2017 09:56:36 +0200
Subject: [PATCH] fall back to DB_PRIVATE on DB_VERSION_MISMATCH
---
ext/repo_rpmdb.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c
index c7000a9..85e327c 100644
--- a/ext/repo_rpmdb.c
+++ b/ext/repo_rpmdb.c
@@ -1246,7 +1246,13 @@ opendbenv(struct rpmdbstate *state)
{
#if defined(FEDORA) || defined(MAGEIA)
int serialize_fd = serialize_dbenv_ops(state);
- r = dbenv->open(dbenv, dbpath, DB_CREATE|DB_INIT_CDB|DB_INIT_MPOOL, 0644);
+ int eflags = DB_CREATE|DB_INIT_CDB|DB_INIT_MPOOL;
+ r = dbenv->open(dbenv, dbpath, eflags, 0644);
+ if (r == DB_VERSION_MISMATCH)
+ {
+ eflags |= DB_PRIVATE;
+ r = dbenv->open(dbenv, dbpath, eflags, 0644);
+ }
if (serialize_fd >= 0)
close(serialize_fd);
#else
--
2.14.1