aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPer Øyvind Karlsen <peroyvind@mandriva.org>2011-04-26 22:16:23 +0000
committerPer Øyvind Karlsen <peroyvind@mandriva.org>2011-04-26 22:16:23 +0000
commitadd2906c9d42915651455f66d7ba9219359e3ca0 (patch)
treece6e61cc833e2e7e85d815841dc17ac697e795c4
parent8f2162174790bfa4cec10704d87602673e8d7e5f (diff)
downloadperl-URPM-add2906c9d42915651455f66d7ba9219359e3ca0.tar
perl-URPM-add2906c9d42915651455f66d7ba9219359e3ca0.tar.gz
perl-URPM-add2906c9d42915651455f66d7ba9219359e3ca0.tar.bz2
perl-URPM-add2906c9d42915651455f66d7ba9219359e3ca0.tar.xz
perl-URPM-add2906c9d42915651455f66d7ba9219359e3ca0.zip
check that rpmdb was properly opened in read/write mode to prevent segfault if no write permissions
-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);