From 18803273406f44b561861a44ba81bca762b31335 Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Wed, 14 Jun 2006 10:08:24 +0000 Subject: Verify if we can open the rpmdb, and abort if we can't (bug #22527) --- URPM.pm | 3 ++- URPM/Signature.pm | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/URPM.pm b/URPM.pm index 9cfb282..c72715d 100644 --- a/URPM.pm +++ b/URPM.pm @@ -364,7 +364,8 @@ specfile. =item open($prefix, $write_perm) -Returns a new C object pointing on the local RPM database. +Returns a new C object pointing on the local RPM database (or +C on failure). $prefix defaults to C<""> and indicates the RPM DB root directory prefix if any. (See the B<--root> option to rpm(1)). diff --git a/URPM/Signature.pm b/URPM/Signature.pm index 6831680..0e9edd8 100644 --- a/URPM/Signature.pm +++ b/URPM/Signature.pm @@ -64,7 +64,8 @@ sub parse_pubkeys { my ($block, $content); my $db = $options{db}; - $db ||= URPM::DB::open($options{root}); + $db ||= URPM::DB::open($options{root}) + or die "Can't open RPM DB, aborting\n"; $db->traverse_tag('name', [ 'gpg-pubkey' ], sub { my ($p) = @_; @@ -97,7 +98,8 @@ sub import_needed_pubkeys { #- use the same database handle to avoid re-opening multiple times the database. my $db = $options{db}; - $db ||= URPM::DB::open($options{root}, 1); + $db ||= URPM::DB::open($options{root}, 1) + or die "Can't open RPM DB, aborting\n"; #- assume $l is a reference to an array containing all the keys to import #- if needed. -- cgit v1.2.1