SOURCES: rpm-Nmalloc.patch (NEW) - patch from jbj that fixes by re...

arekm arekm at pld-linux.org
Wed May 23 20:26:45 CEST 2007


Author: arekm                        Date: Wed May 23 18:26:45 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- patch from jbj that fixes by re-malloc of rpmdsN()

---- Files affected:
SOURCES:
   rpm-Nmalloc.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/rpm-Nmalloc.patch
diff -u /dev/null SOURCES/rpm-Nmalloc.patch:1.1
--- /dev/null	Wed May 23 20:26:45 2007
+++ SOURCES/rpm-Nmalloc.patch	Wed May 23 20:26:40 2007
@@ -0,0 +1,156 @@
+Index: depends.c
+===================================================================
+RCS file: /cvs/devel/rpm/lib/depends.c,v
+retrieving revision 1.325.2.78
+diff -u -b -B -w -p -r1.325.2.78 depends.c
+--- rpm/lib/depends.c	16 May 2007 11:47:44 -0000	1.325.2.78
++++ rpm/lib/depends.c	22 May 2007 11:41:02 -0000
+@@ -1264,12 +1264,12 @@ static int checkPackageDeps(rpmts ts, co
+  * Adding: check name/provides dep against each conflict match,
+  * Erasing: check name/provides/filename dep against each requiredby match.
+  * @param ts		transaction set
+- * @param dep		dependency name
++ * @param depName	dependency name
+  * @param mi		rpm database iterator
+  * @param adding	dependency is from added package set?
+  * @return		0 no problems found
+  */
+-static int checkPackageSet(rpmts ts, const char * dep,
++static int checkPackageSet(rpmts ts, const char * depName,
+ 		/*@only@*/ /*@null@*/ rpmdbMatchIterator mi, int adding)
+ 	/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
+ 	/*@modifies ts, mi, rpmGlobalMacroContext, fileSystem, internalState @*/
+@@ -1307,7 +1307,7 @@ static int checkPackageSet(rpmts ts, con
+ 
+ 	rc = checkPackageDeps(ts, pkgNEVRA,
+ 		requires, conflicts, dirnames, linktos,
+-		dep, tscolor, adding);
++		depName, tscolor, adding);
+ 
+ 	linktos = rpmdsFree(linktos);
+ 	dirnames = rpmdsFree(dirnames);
+@@ -1328,10 +1328,10 @@ static int checkPackageSet(rpmts ts, con
+ /**
+  * Check to-be-erased dependencies against installed requires.
+  * @param ts		transaction set
+- * @param dep		requires name
++ * @param depName	requires name
+  * @return		0 no problems found
+  */
+-static int checkDependentPackages(rpmts ts, const char * dep)
++static int checkDependentPackages(rpmts ts, const char * depName)
+ 	/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
+ 	/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/
+ {
+@@ -1340,8 +1340,8 @@ static int checkDependentPackages(rpmts 
+     /* XXX rpmdb can be closed here, avoid error msg. */
+     if (rpmtsGetRdb(ts) != NULL) {
+ 	rpmdbMatchIterator mi;
+-	mi = rpmtsInitIterator(ts, RPMTAG_REQUIRENAME, dep, 0);
+-	rc = checkPackageSet(ts, dep, mi, 0);
++	mi = rpmtsInitIterator(ts, RPMTAG_REQUIRENAME, depName, 0);
++	rc = checkPackageSet(ts, depName, mi, 0);
+     }
+     return rc;
+ }
+@@ -1349,10 +1349,10 @@ static int checkDependentPackages(rpmts 
+ /**
+  * Check to-be-added dependencies against installed conflicts.
+  * @param ts		transaction set
+- * @param dep		conflicts name
++ * @param depName	conflicts name
+  * @return		0 no problems found
+  */
+-static int checkDependentConflicts(rpmts ts, const char * dep)
++static int checkDependentConflicts(rpmts ts, const char * depName)
+ 	/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
+ 	/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/
+ {
+@@ -1361,8 +1361,8 @@ static int checkDependentConflicts(rpmts
+     /* XXX rpmdb can be closed here, avoid error msg. */
+     if (rpmtsGetRdb(ts) != NULL) {
+ 	rpmdbMatchIterator mi;
+-	mi = rpmtsInitIterator(ts, RPMTAG_CONFLICTNAME, dep, 0);
+-	rc = checkPackageSet(ts, dep, mi, 1);
++	mi = rpmtsInitIterator(ts, RPMTAG_CONFLICTNAME, depName, 0);
++	rc = checkPackageSet(ts, depName, mi, 1);
+     }
+ 
+     return rc;
+@@ -2277,6 +2277,7 @@ assert(newOrderCount == ts->orderCount);
+ 
+ int rpmtsCheck(rpmts ts)
+ {
++    const char * depName = NULL;;
+     rpmdepFlags depFlags = rpmtsDFlags(ts);
+     uint_32 tscolor = rpmtsColor(ts);
+     rpmdbMatchIterator mi = NULL;
+@@ -2331,17 +2332,15 @@ int rpmtsCheck(rpmts ts)
+ 	provides = rpmdsInit(provides);
+ 	if (provides != NULL)
+ 	while (rpmdsNext(provides) >= 0) {
+-	    const char * Name;
+-
+-	    if ((Name = rpmdsN(provides)) == NULL)
+-		/*@innercontinue@*/ continue;	/* XXX can't happen */
++	    depName = _free(depName);
++	    depName = xstrdup(rpmdsN(provides));
+ 
+ #ifdef	NOTYET
+ 	    if (rpmdsNSType(provides) == RPMNS_TYPE_ENVVAR) {
+ 		const char * EVR = rpmdsEVR(provides);
+ 		if (rpmdsNegateRC(provides, 0))
+ 		    EVR = NULL;
+-		rc = envPut(Name, EVR);
++		rc = envPut(depName, EVR);
+ 		if (!rc)
+ 		    /*@innercontinue@*/ continue;
+ 		/*@innerbreak@*/ break;
+@@ -2349,7 +2348,7 @@ int rpmtsCheck(rpmts ts)
+ #endif
+ 
+ 	    /* Adding: check provides key against conflicts matches. */
+-	    if (!checkDependentConflicts(ts, Name))
++	    if (!checkDependentConflicts(ts, depName))
+ 		/*@innercontinue@*/ continue;
+ 	    rc = 1;
+ 	    /*@innerbreak@*/ break;
+@@ -2377,13 +2376,11 @@ int rpmtsCheck(rpmts ts)
+ 	provides = rpmdsInit(provides);
+ 	if (provides != NULL)
+ 	while (rpmdsNext(provides) >= 0) {
+-	    const char * Name;
+-
+-	    if ((Name = rpmdsN(provides)) == NULL)
+-		/*@innercontinue@*/ continue;	/* XXX can't happen */
++	    depName = _free(depName);
++	    depName = xstrdup(rpmdsN(provides));
+ 
+ 	    /* Erasing: check provides against requiredby matches. */
+-	    if (!checkDependentPackages(ts, Name))
++	    if (!checkDependentPackages(ts, depName))
+ 		/*@innercontinue@*/ continue;
+ 	    rc = 1;
+ 	    /*@innerbreak@*/ break;
+@@ -2395,10 +2392,10 @@ int rpmtsCheck(rpmts ts)
+ 	fi = rpmteFI(p, RPMTAG_BASENAMES);
+ 	fi = rpmfiInit(fi, 0);
+ 	while (rpmfiNext(fi) >= 0) {
+-	    const char * fn = rpmfiFN(fi);
+-
++	    depName = _free(depName);
++	    depName = xstrdup(rpmfiFN(fi));
+ 	    /* Erasing: check filename against requiredby matches. */
+-	    if (!checkDependentPackages(ts, fn))
++	    if (!checkDependentPackages(ts, depName))
+ 		/*@innercontinue@*/ continue;
+ 	    rc = 1;
+ 	    /*@innerbreak@*/ break;
+@@ -2429,6 +2426,7 @@ int rpmtsCheck(rpmts ts)
+ exit:
+     mi = rpmdbFreeIterator(mi);
+     pi = rpmtsiFree(pi);
++    depName = _free(depName);
+ 
+     (void) rpmswExit(rpmtsOp(ts, RPMTS_OP_CHECK), 0);
+ 
================================================================


More information about the pld-cvs-commit mailing list