summaryrefslogtreecommitdiff
path: root/lib/backend
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2012-05-03 16:15:59 +0300
committerPanu Matilainen <pmatilai@redhat.com>2012-05-03 16:37:51 +0300
commit58c5eb28d5f267313294486c6f8a7a6c84984d86 (patch)
treeebcbda98cec9254f5f4179ce0fc1506fd6205c00 /lib/backend
parent5f0bdf9e8af3dfc07aaa7c82671bec4915aaab78 (diff)
downloadlibrpm-tizen-58c5eb28d5f267313294486c6f8a7a6c84984d86.tar.gz
librpm-tizen-58c5eb28d5f267313294486c6f8a7a6c84984d86.tar.bz2
librpm-tizen-58c5eb28d5f267313294486c6f8a7a6c84984d86.zip
Fall back to private db environment on system level EINVAL
- BDB wants to use mmap() for its environment by default, but not all (file)systems support this, as pointed out by Daniel Drak. However env->open() can return EINVAL for a number of reasons, require all the fallback reasons to be system level errors to differentiate from "logical" errors such as incompatible flags to (possibly pre-existing) db environment, in which case we better just error out.
Diffstat (limited to 'lib/backend')
-rw-r--r--lib/backend/db3.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/backend/db3.c b/lib/backend/db3.c
index 30ed7acd5..bbf957752 100644
--- a/lib/backend/db3.c
+++ b/lib/backend/db3.c
@@ -177,7 +177,8 @@ static int db_init(rpmdb rdb, const char * dbhome)
/*
* Actually open the environment. Fall back to private environment
- * if we dont have permission to join/create shared environment.
+ * if we dont have permission to join/create shared environment or
+ * system doesn't support it..
*/
while (retry_open) {
char *fstr = prDbiOpenFlags(eflags, 1);
@@ -185,7 +186,7 @@ static int db_init(rpmdb rdb, const char * dbhome)
free(fstr);
rc = (dbenv->open)(dbenv, dbhome, eflags, rdb->db_perms);
- if (rc == EACCES || rc == EROFS) {
+ if ((rc == EACCES || rc == EROFS || rc == EINVAL) && errno == rc) {
eflags |= DB_PRIVATE;
retry_open--;
} else {