rpm/dbrointerruptable.diff

58 lines
1.6 KiB
Diff
Raw Normal View History

Do not block signals if the database is opened read-only, it jst
annoys the users. [#48026]
--- ./rpmdb/rpmdb.c.orig 2005-02-16 03:18:19.000000000 +0000
+++ ./rpmdb/rpmdb.c 2006-02-21 20:37:44.000000000 +0000
@@ -846,10 +873,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, "rpmdbClose");
/*@-usereleased@*/
@@ -886,12 +915,14 @@ int rpmdbClose(rpmdb db)
/*@-refcounttrans@*/ db = _free(db); /*@=refcounttrans@*/
/*@=usereleased@*/
+ 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;
}
/*@=incondefs@*/
@@ -1021,11 +1070,13 @@ static int openDatabase(/*@null@*/ const
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;