commit 36f6874fcf5222f4553fb5b7782af18c7b6ea92a
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Fri Apr 15 09:18:15 2011 +0300
Only muck with signals on first and last db open/close
- Signals are per-process global, as long as there are other
databases open (or references to the same db) we shouldn't mess
with them. Less important on open, but if somebody is changing
rpmsq-handling we shouldn't override that either.
(cherry picked from commit dcf650f5a73846773c7b81de08e2608391f733b8)
diff --git a/lib/rpmdb.c b/lib/rpmdb.c
index 50bb6b1..44cdb2b 100644
--- a/lib/rpmdb.c
+++ b/lib/rpmdb.c
@@ -661,12 +661,14 @@ int rpmdbClose(rpmdb db)
db = _free(db);
+ if (rpmdbRock == NULL) {
+ (void) rpmsqEnable(-SIGHUP, NULL);
+ (void) rpmsqEnable(-SIGINT, NULL);
+ (void) rpmsqEnable(-SIGTERM, NULL);
+ (void) rpmsqEnable(-SIGQUIT, NULL);
+ (void) rpmsqEnable(-SIGPIPE, NULL);
+ }
exit:
- (void) rpmsqEnable(-SIGHUP, NULL);
- (void) rpmsqEnable(-SIGINT, NULL);
- (void) rpmsqEnable(-SIGTERM,NULL);
- (void) rpmsqEnable(-SIGQUIT,NULL);
- (void) rpmsqEnable(-SIGPIPE,NULL);
return rc;
}
@@ -728,11 +730,13 @@ 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) {
- (void) rpmsqEnable(SIGHUP, NULL);
- (void) rpmsqEnable(SIGINT, NULL);
- (void) rpmsqEnable(SIGTERM,NULL);
- (void) rpmsqEnable(SIGQUIT,NULL);
- (void) rpmsqEnable(SIGPIPE,NULL);
+ if (rpmdbRock == NULL) {
+ (void) rpmsqEnable(SIGHUP, NULL);
+ (void) rpmsqEnable(SIGINT, NULL);
+ (void) rpmsqEnable(SIGTERM, NULL);
+ (void) rpmsqEnable(SIGQUIT, NULL);
+ (void) rpmsqEnable(SIGPIPE, NULL);
+ }
/* Just the primary Packages database opened here */
rc = (rpmdbOpenIndex(db, RPMDBI_PACKAGES, db->db_flags) != NULL) ? 0 : -2;