SHA256
3
0
forked from pool/rpm
rpm/dbrointerruptable.diff

33 lines
1.1 KiB
Diff

--- ./lib/rpmdb.c.orig 2016-10-21 09:44:00.306962087 +0000
+++ ./lib/rpmdb.c 2017-01-19 10:36:12.529219141 +0000
@@ -450,9 +450,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)
@@ -487,7 +489,7 @@ int rpmdbClose(rpmdb db)
db = _free(db);
- if (rpmdbRock == NULL) {
+ if (rpmdbRock == NULL && (dbmode & (O_RDWR|O_WRONLY)) != 0) {
(void) rpmsqEnable(-SIGHUP, NULL);
(void) rpmsqEnable(-SIGINT, NULL);
(void) rpmsqEnable(-SIGTERM, NULL);
@@ -572,7 +574,7 @@ static int openDatabase(const char * pre
/* Try to ensure db home exists, error out if we can't even create */
rc = rpmioMkpath(rpmdbHome(db), 0755, getuid(), getgid());
if (rc == 0) {
- if (rpmdbRock == NULL) {
+ if (rpmdbRock == NULL && (db->db_mode & (O_RDWR|O_WRONLY)) != 0) {
(void) rpmsqEnable(SIGHUP, NULL);
(void) rpmsqEnable(SIGINT, NULL);
(void) rpmsqEnable(SIGTERM, NULL);