summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2009-05-19 10:26:50 +0300
committerPanu Matilainen <pmatilai@redhat.com>2009-05-19 10:30:21 +0300
commitb581d887dbabf198b87466a4d5ac0dbf80bfdb51 (patch)
tree8dda106636f47e40d1ad391109545a6afe7985ad
parentb45b326ba2be88e00bc21cdd626d63e7c86ed33a (diff)
downloadrpm-b581d887dbabf198b87466a4d5ac0dbf80bfdb51.tar.gz
Don't mess up problem altNEVR in python ts.check() (rhbz#501068)
- the use of strrchr() silently casts away the const from the problem set altNEVR string, which we then happily modify.. - similar to commit 62cc76e25cdfad78ac30bb28f626b474efdecddc (cherry picked from commit 9322f737819a3d81088699b1d7fa667259245411)
-rw-r--r--python/rpmts-py.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/python/rpmts-py.c b/python/rpmts-py.c
index 0d7efadb9..9850df192 100644
--- a/python/rpmts-py.c
+++ b/python/rpmts-py.c
@@ -369,7 +369,7 @@ fprintf(stderr, "*** rpmts_Check(%p) ts %p cb %p\n", s, s->ts, cbInfo.cb);
/* XXX TODO: rpmlib >= 4.0.3 can return multiple suggested keys. */
while ((i = rpmpsNextIterator(psi)) >= 0) {
- const char * needsName;
+ char * altNEVR, * needsName;
char * byName, * byVersion, * byRelease, *byArch;
char * needsOP, * needsVersion;
rpmsenseFlags needsFlags, sense;
@@ -387,7 +387,7 @@ fprintf(stderr, "*** rpmts_Check(%p) ts %p cb %p\n", s, s->ts, cbInfo.cb);
key = rpmProblemGetKey(p);
- needsName = rpmProblemGetAltNEVR(p);
+ altNEVR = needsName = xstrdup(rpmProblemGetAltNEVR(p));
if (needsName[1] == ' ') {
sense = (needsName[0] == 'C')
? RPMDEP_SENSE_CONFLICTS : RPMDEP_SENSE_REQUIRES;
@@ -413,6 +413,7 @@ fprintf(stderr, "*** rpmts_Check(%p) ts %p cb %p\n", s, s->ts, cbInfo.cb);
PyList_Append(list, (PyObject *) cf);
Py_DECREF(cf);
free(byName);
+ free(altNEVR);
}
psi = rpmpsFreeIterator(psi);