teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame SOURCES/ndb_query_ro_media.patch

352c6c
From 93e482be29ee683011c71f23b3b0096889e50331 Mon Sep 17 00:00:00 2001
352c6c
From: Michael Schroeder <mls@suse.de>
352c6c
Date: Mon, 3 Feb 2020 11:37:30 +0100
352c6c
Subject: [PATCH] Permit ndb database queries on read-only media
352c6c
352c6c
See also commit a429c99e13fbe9926243f29b78df8d64222c4469 for db3.
352c6c
---
352c6c
 lib/backend/ndb/glue.c | 2 +-
352c6c
 1 file changed, 1 insertion(+), 1 deletion(-)
352c6c
352c6c
diff --git a/lib/backend/ndb/glue.c b/lib/backend/ndb/glue.c
352c6c
index 90c10f8894..d19da7c5cd 100644
352c6c
--- a/lib/backend/ndb/glue.c
352c6c
+++ b/lib/backend/ndb/glue.c
352c6c
@@ -161,7 +161,7 @@ static int ndb_Open(rpmdb rdb, rpmDbiTagVal rpmtag, dbiIndex * dbip, int flags)
352c6c
 	    /* Open indexes readwrite if possible */
352c6c
 	    ioflags = O_RDWR;
352c6c
 	    rc = rpmxdbOpen(&ndbenv->xdb, rdb->db_pkgs->dbi_db, path, ioflags, 0666);
352c6c
-	    if (rc && errno == EACCES) {
352c6c
+	    if (rc && (errno == EACCES || errno == EROFS)) {
352c6c
 		/* If it is not asked for rw explicitly, try to open ro */
352c6c
 		if (!(oflags & O_RDWR)) {
352c6c
 		    ioflags = O_RDONLY;