From 54798cd06a89c12f07ab821bbfb32395286f12d2 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Tue, 16 Aug 2011 17:57:45 +0200 Subject: [PATCH] Fixed a bug causing alternate repositories packages to be skipped when name follows last package in main repositories (e.g. zzuf) --- src/headerlist.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/headerlist.c b/src/headerlist.c index 5dca3c9..8527263 100644 --- a/src/headerlist.c +++ b/src/headerlist.c @@ -821,10 +821,9 @@ addToHeaderList(struct configTag *ct, currname[0] = '\0'; } for (i = 0; i < ALT_REPS_MAX; i++) { - /* scan alternate repositories to find better matches */ -// printf("currname:%s alt:%s\n",currname,altscanpath[i]); + /* scan alternate repositories to find any packge which comes first according to name sorting */ 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); } } @@ -839,7 +838,7 @@ addToHeaderList(struct configTag *ct, } 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)) { /* selected package exists in this repository */ memcpy(filepath, altscanpath[i], strlen(altscanpath[i]) + 1);