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.
This commit is contained in:
parent
5f0bdf9e8a
commit
58c5eb28d5
|
@ -177,7 +177,8 @@ static int db_init(rpmdb rdb, const char * dbhome)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actually open the environment. Fall back to private environment
|
* 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) {
|
while (retry_open) {
|
||||||
char *fstr = prDbiOpenFlags(eflags, 1);
|
char *fstr = prDbiOpenFlags(eflags, 1);
|
||||||
|
@ -185,7 +186,7 @@ static int db_init(rpmdb rdb, const char * dbhome)
|
||||||
free(fstr);
|
free(fstr);
|
||||||
|
|
||||||
rc = (dbenv->open)(dbenv, dbhome, eflags, rdb->db_perms);
|
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;
|
eflags |= DB_PRIVATE;
|
||||||
retry_open--;
|
retry_open--;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue