fix read-only filesystem db access
OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=532
This commit is contained in:
parent
cdda0f569d
commit
80e2e8d485
@ -1,5 +1,5 @@
|
||||
--- ./lib/backend/ndb/glue.c.orig 2020-01-23 12:47:46.527816289 +0000
|
||||
+++ ./lib/backend/ndb/glue.c 2020-01-23 12:48:20.915728982 +0000
|
||||
+++ ./lib/backend/ndb/glue.c 2020-02-03 12:57:34.817304473 +0000
|
||||
@@ -52,8 +52,8 @@ static void closeEnv(rpmdb rdb)
|
||||
if (ndbenv->data)
|
||||
free(ndbenv->data);
|
||||
@ -42,7 +42,7 @@
|
||||
static int ndb_Open(rpmdb rdb, rpmDbiTagVal rpmtag, dbiIndex * dbip, int flags)
|
||||
{
|
||||
const char *dbhome = rpmdbHome(rdb);
|
||||
@@ -130,6 +155,7 @@ static int ndb_Open(rpmdb rdb, rpmDbiTag
|
||||
@@ -130,12 +155,13 @@ static int ndb_Open(rpmdb rdb, rpmDbiTag
|
||||
}
|
||||
if (!ndbenv->xdb) {
|
||||
char *path = rstrscat(NULL, dbhome, "/Index.db", NULL);
|
||||
@ -50,6 +50,13 @@
|
||||
rpmlog(RPMLOG_DEBUG, "opening db index %s mode=0x%x\n", path, rdb->db_mode);
|
||||
|
||||
/* Open indexes readwrite if possible */
|
||||
ioflags = O_RDWR;
|
||||
rc = rpmxdbOpen(&ndbenv->xdb, rdb->db_pkgs->dbi_db, path, ioflags, 0666);
|
||||
- if (rc && errno == EACCES) {
|
||||
+ if (rc && (errno == EACCES || errno == EROFS)) {
|
||||
/* If it is not asked for rw explicitly, try to open ro */
|
||||
if (!(oflags & O_RDWR)) {
|
||||
ioflags = O_RDONLY;
|
||||
@@ -144,6 +170,7 @@ static int ndb_Open(rpmdb rdb, rpmDbiTag
|
||||
} else if (rc && errno == ENOENT) {
|
||||
ioflags = O_CREAT|O_RDWR;
|
||||
|
Loading…
Reference in New Issue
Block a user