summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2012-10-11 12:33:26 -0700
committerAnas Nashif <anas.nashif@intel.com>2013-02-02 16:44:14 -0800
commit15f6d9b7d68a98824c0a7a71fd48694887e86b78 (patch)
tree0c117194b9f323f14dd46309682a16c1b8aa43b9 /lib
parenta1398d58d1b56ca0fdeac880461a9587f2f0e98b (diff)
downloadrpm-15f6d9b7d68a98824c0a7a71fd48694887e86b78.tar.gz
rpm-15f6d9b7d68a98824c0a7a71fd48694887e86b78.tar.bz2
rpm-15f6d9b7d68a98824c0a7a71fd48694887e86b78.zip
db ro interruptable
Diffstat (limited to 'lib')
-rw-r--r--lib/rpmdb.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/rpmdb.c b/lib/rpmdb.c
index a83b90247..1a2fda504 100644
--- a/lib/rpmdb.c
+++ b/lib/rpmdb.c
@@ -730,10 +730,12 @@ int rpmdbClose(rpmdb db)
{
rpmdb * prev, next;
int rc = 0;
+ int dbmode;
if (db == NULL)
goto exit;
+ dbmode = db->db_mode;
(void) rpmdbUnlink(db);
if (db->nrefs > 0)
@@ -761,7 +763,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);
@@ -830,7 +832,7 @@ static int openDatabase(const char * prefix,
/* Try to ensure db home exists, error out if we cant 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);