aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPer Øyvind Karlsen <peroyvind@mandriva.org>2011-01-06 16:16:14 +0000
committerPer Øyvind Karlsen <peroyvind@mandriva.org>2011-01-06 16:16:14 +0000
commitc8d377dcb0d6997f8eba4057ac7c283e9fc0ee08 (patch)
tree7680abcb2c28d768ff1486404e90f65c74072fa6
parentecf169cda8a941162c4797da967e0d4ee8e68a2a (diff)
downloadperl-URPM-c8d377dcb0d6997f8eba4057ac7c283e9fc0ee08.tar
perl-URPM-c8d377dcb0d6997f8eba4057ac7c283e9fc0ee08.tar.gz
perl-URPM-c8d377dcb0d6997f8eba4057ac7c283e9fc0ee08.tar.bz2
perl-URPM-c8d377dcb0d6997f8eba4057ac7c283e9fc0ee08.tar.xz
perl-URPM-c8d377dcb0d6997f8eba4057ac7c283e9fc0ee08.zip
check URPM::Transactin::add() for errors and return them if any (#61746)
-rw-r--r--NEWS3
-rw-r--r--URPM.xs11
2 files changed, 12 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 9ab4835..549913d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,6 @@
-Version 4.4 - Dec 2010, by
+Version 4.4 - Jan 2011, by
+- check URPM::Transactin::add() for errors and return them if any (#61746)
- make URPM::Package::get_tag() & URPM::Package::get_tag_modifiers() accept
string name of tags
- URPM::DB::traverse_tag() & URPM::DB::traverse_tag_find() will now accept
diff --git a/URPM.xs b/URPM.xs
index 1973a97..0e72818 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -3036,6 +3036,7 @@ Trans_add(trans, pkg, ...)
CODE:
if ((pkg->flag & FLAG_ID) <= FLAG_ID_MAX && pkg->h != NULL) {
int update = 0;
+ int rc;
rpmRelocation relocations = NULL;
/* compability mode with older interface of add */
if (items == 3) {
@@ -3064,9 +3065,17 @@ Trans_add(trans, pkg, ...)
}
}
}
- RETVAL = rpmtsAddInstallElement(trans->ts, pkg->h, (fnpyKey)(1+(long)(pkg->flag & FLAG_ID)), update, relocations) == 0;
+ rc = rpmtsAddInstallElement(trans->ts, pkg->h, (fnpyKey)(1+(long)(pkg->flag & FLAG_ID)), update, relocations);
+ if(rc) {
+ rpmps ps = rpmtsProblems(trans->ts);
+ PUTBACK;
+ return_problems(ps, 1, 0);
+ SPAGAIN;
+ }
+
/* free allocated memory, check rpm is copying it just above, at least in 4.0.4 */
rpmfiFreeRelocations(relocations);
+ RETVAL = rc == 0;
} else RETVAL = 0;
OUTPUT:
RETVAL