File dbrointerruptable.diff of Package rpm.21496
--- ./lib/rpmdb.c.orig 2020-04-28 12:50:11.821399101 +0000
+++ ./lib/rpmdb.c 2021-04-21 12:07:01.388230889 +0000
@@ -387,9 +387,11 @@ int rpmdbClose(rpmdb db)
{
rpmdb * prev, next;
int rc = 0;
+ int dbmode;
if (db == NULL)
goto exit;
+ dbmode = db->db_mode;
prev = &rpmdbRock;
while ((next = *prev) != NULL && next != db)
@@ -424,7 +426,7 @@ int rpmdbClose(rpmdb db)
db = _free(db);
- if (rpmdbRock == NULL) {
+ if (rpmdbRock == NULL && (dbmode & (O_RDWR|O_WRONLY)) != 0) {
rpmsqActivate(0);
}
exit:
@@ -509,7 +511,7 @@ static int openDatabase(const char * pre
rc = rpmioMkpath(rpmdbHome(db), 0755, getuid(), getgid());
if (rc == 0) {
/* Enable signal queue on the first db open */
- if (db->db_next == NULL) {
+ if (db->db_next == NULL && (db->db_mode & (O_RDWR|O_WRONLY)) != 0) {
rpmsqActivate(1);
}