rpm/dbrointerruptable.diff
OBS User autobuild a76d6c30a2 Accepting request 18841 from Base:System
Copy from Base:System/rpm based on submit request 18841 from user mlschroe

OBS-URL: https://build.opensuse.org/request/show/18841
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/rpm?expand=0&rev=84
2009-08-28 13:54:03 +00:00

60 lines
1.5 KiB
Diff

Do not block signals if the database is opened read-only, it jst
annoys the users. [#48026]
Index: lib/rpmdb.c
===================================================================
--- lib/rpmdb.c.orig
+++ lib/rpmdb.c
@@ -819,10 +819,12 @@ int rpmdbClose(rpmdb db)
rpmdb * prev, next;
int dbix;
int rc = 0;
+ int dbmode;
if (db == NULL)
goto exit;
+ dbmode = db->db_mode;
(void) rpmdbUnlink(db, RPMDBG_M("rpmdbClose"));
if (db->nrefs > 0)
@@ -855,12 +857,14 @@ int rpmdbClose(rpmdb db)
dbiTagsFree();
+ if ((dbmode & (O_RDWR|O_WRONLY)) != 0) {
+ (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;
}
@@ -956,11 +960,13 @@ static int openDatabase(const char * pre
if (db == NULL)
return 1;
- (void) rpmsqEnable(SIGHUP, NULL);
- (void) rpmsqEnable(SIGINT, NULL);
- (void) rpmsqEnable(SIGTERM,NULL);
- (void) rpmsqEnable(SIGQUIT,NULL);
- (void) rpmsqEnable(SIGPIPE,NULL);
+ if ((db->db_mode & (O_RDWR|O_WRONLY)) != 0) {
+ (void) rpmsqEnable(SIGHUP, NULL);
+ (void) rpmsqEnable(SIGINT, NULL);
+ (void) rpmsqEnable(SIGTERM,NULL);
+ (void) rpmsqEnable(SIGQUIT,NULL);
+ (void) rpmsqEnable(SIGPIPE,NULL);
+ }
db->db_api = _dbapi;