teknoraver / rpms / rpm

Forked from rpms/rpm 3 months ago
Clone
Blob Blame History Raw
From 93e482be29ee683011c71f23b3b0096889e50331 Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Mon, 3 Feb 2020 11:37:30 +0100
Subject: [PATCH] Permit ndb database queries on read-only media

See also commit a429c99e13fbe9926243f29b78df8d64222c4469 for db3.
---
 lib/backend/ndb/glue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/backend/ndb/glue.c b/lib/backend/ndb/glue.c
index 90c10f8894..d19da7c5cd 100644
--- a/lib/backend/ndb/glue.c
+++ b/lib/backend/ndb/glue.c
@@ -161,7 +161,7 @@ static int ndb_Open(rpmdb rdb, rpmDbiTagVal rpmtag, dbiIndex * dbip, int flags)
 	    /* 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;