summaryrefslogtreecommitdiff
path: root/python/rpmmi-py.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2009-09-22 19:19:02 +0300
committerPanu Matilainen <pmatilai@redhat.com>2009-09-22 19:19:02 +0300
commitda74188fa654246ec74e0375440f326e5dc714f2 (patch)
tree81ab358d268b42147278025a23e8a1c701a98c3d /python/rpmmi-py.c
parent00d683ce88748080ce78d1e2d802a401b2d30261 (diff)
downloadlibrpm-tizen-da74188fa654246ec74e0375440f326e5dc714f2.tar.gz
librpm-tizen-da74188fa654246ec74e0375440f326e5dc714f2.tar.bz2
librpm-tizen-da74188fa654246ec74e0375440f326e5dc714f2.zip
Sanitize python object -> tag number exception handling
- raise exception in tagNumFromPyObject(), not in 12 different callers - check against RPMTAG_NOT_FOUND consistently instead of -1 and whatnot - unknown tags are value, not key or type errors
Diffstat (limited to 'python/rpmmi-py.c')
-rw-r--r--python/rpmmi-py.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/python/rpmmi-py.c b/python/rpmmi-py.c
index 95060ab13..08b02e840 100644
--- a/python/rpmmi-py.c
+++ b/python/rpmmi-py.c
@@ -152,10 +152,8 @@ rpmmi_Pattern(rpmmiObject * s, PyObject * args, PyObject * kwds)
&TagN, &type, &pattern))
return NULL;
- if ((tag = tagNumFromPyObject (TagN)) == -1) {
- PyErr_SetString(PyExc_TypeError, "unknown tag type");
- return NULL;
- }
+ tag = tagNumFromPyObject (TagN);
+ if (tag == RPMTAG_NOT_FOUND) return NULL;
rpmdbSetIteratorRE(s->mi, tag, type, pattern);