aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS5
-rw-r--r--URPM.xs6
2 files changed, 11 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 108251e..2ba5476 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+Verison 4.23 - 2011, by Per Øyvind Karlsen
+
+- check that rpmdb was properly opened in read/write mode to prevent segfault
+ if no write permissions
+
Version 4.22 - 26 April 2011, by Per Øyvind Karlsen
- add support for notriggers
diff --git a/URPM.xs b/URPM.xs
index 2814477..7b9b376 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -3175,6 +3175,12 @@ Db_open(prefix=NULL, write_perm=0, log_auto_remove=1)
if(write_perm) {
rpmdb rdb = rpmtsGetRdb(db->ts);
DB_ENV *dbenv = rdb->db_dbenv;
+
+ if (dbenv == NULL) {
+ (void)rpmtsFree(db->ts);
+ croak("unable to open rpmdb in read/write mode, write permissions missing?");
+ }
+
/* TODO: allow for user configuration? */
if(log_auto_remove)
dbenv->log_set_config(dbenv, DB_LOG_AUTO_REMOVE, 1);