xbps_rpool_foreach: process all entries in order.
if xbps_repo_open() fails then the repo is removed from array xbps_repo_remove() but as we've removed the entry from it, the index won't be valid any more, resulting in skipped entries. If a entry is removed restart again at the correct index. Close #127
This commit is contained in:
parent
b12b72e151
commit
3a00a9eb9b
@ -141,16 +141,19 @@ xbps_rpool_foreach(struct xbps_handle *xhp,
|
||||
const char *repouri;
|
||||
int rv = 0;
|
||||
bool foundrepo = false, done = false;
|
||||
unsigned int n = 0;
|
||||
|
||||
assert(fn != NULL);
|
||||
|
||||
for (unsigned int i = 0; i < xbps_array_count(xhp->repositories); i++) {
|
||||
again:
|
||||
for (unsigned int i = n; i < xbps_array_count(xhp->repositories); i++, n++) {
|
||||
xbps_array_get_cstring_nocopy(xhp->repositories, i, &repouri);
|
||||
xbps_dbg_printf(xhp, "[rpool] checking `%s' at index %u\n", repouri, n);
|
||||
if ((repo = xbps_rpool_get_repo(repouri)) == NULL) {
|
||||
repo = xbps_repo_open(xhp, repouri);
|
||||
if (!repo) {
|
||||
xbps_repo_remove(xhp, repouri);
|
||||
continue;
|
||||
goto again;
|
||||
}
|
||||
SIMPLEQ_INSERT_TAIL(&rpool_queue, repo, entries);
|
||||
xbps_dbg_printf(xhp, "[rpool] `%s' registered.\n", repouri);
|
||||
|
Loading…
Reference in New Issue
Block a user