Fixed a bug causing alternate repositories packages to be skipped when name follows last package in main repositories (e.g. zzuf)

This commit is contained in:
Silvan Calarco 2011-08-16 17:57:45 +02:00
parent e4d8771c25
commit 54798cd06a

View File

@ -821,10 +821,9 @@ addToHeaderList(struct configTag *ct,
currname[0] = '\0'; currname[0] = '\0';
} }
for (i = 0; i < ALT_REPS_MAX; i++) { for (i = 0; i < ALT_REPS_MAX; i++) {
/* scan alternate repositories to find better matches */ /* scan alternate repositories to find any packge which comes first according to name sorting */
// printf("currname:%s alt:%s\n",currname,altscanpath[i]);
if (altscanpath[i] && (altcnt[i] < altn[i]) && if (altscanpath[i] && (altcnt[i] < altn[i]) &&
(rpmnamecmp(currname, altnamelist[i][altcnt[i]]->d_name,0) >= 0)) { ((rpmnamecmp(currname, altnamelist[i][altcnt[i]]->d_name,0) >= 0) || (currname[0] == '\0'))) {
strncpy(currname, altnamelist[i][altcnt[i]]->d_name,bufsize); strncpy(currname, altnamelist[i][altcnt[i]]->d_name,bufsize);
} }
} }
@ -839,7 +838,7 @@ addToHeaderList(struct configTag *ct,
} }
for (i = 0; i < ALT_REPS_MAX; i++) { for (i = 0; i < ALT_REPS_MAX; i++) {
if (altscanpath[i] && (altcnt[i] < altn[i]) && if (altscanpath[i] && (altcnt[i] < altn[i]) &&
(strncmp(currname, altnamelist[i][altcnt[i]]->d_name, bufsize) == 0)) { (strncmp(currname, altnamelist[i][altcnt[i]]->d_name, bufsize) == 0)) {
/* selected package exists in this repository */ /* selected package exists in this repository */
memcpy(filepath, altscanpath[i], strlen(altscanpath[i]) + 1); memcpy(filepath, altscanpath[i], strlen(altscanpath[i]) + 1);