Michael Schröder
cebe6dd1a8
OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=93
57 lines
1.7 KiB
Diff
57 lines
1.7 KiB
Diff
Do not block signals if the database is opened read-only, it just
|
|
annoys the users. [#48026]
|
|
|
|
--- ./lib/rpmdb.c.orig 2011-02-28 09:57:27.000000000 +0000
|
|
+++ ./lib/rpmdb.c 2011-05-10 16:58:21.000000000 +0000
|
|
@@ -623,10 +623,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)
|
|
@@ -655,11 +657,13 @@ int rpmdbClose(rpmdb db)
|
|
db = _free(db);
|
|
|
|
exit:
|
|
- (void) rpmsqEnable(-SIGHUP, NULL);
|
|
- (void) rpmsqEnable(-SIGINT, NULL);
|
|
- (void) rpmsqEnable(-SIGTERM,NULL);
|
|
- (void) rpmsqEnable(-SIGQUIT,NULL);
|
|
- (void) rpmsqEnable(-SIGPIPE,NULL);
|
|
+ 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);
|
|
+ }
|
|
return rc;
|
|
}
|
|
|
|
@@ -721,11 +725,13 @@ static int openDatabase(const char * pre
|
|
/* 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 ((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);
|
|
+ }
|
|
|
|
/* Just the primary Packages database opened here */
|
|
rc = (rpmdbOpenIndex(db, RPMDBI_PACKAGES, db->db_flags) != NULL) ? 0 : -2;
|