diff options
Diffstat (limited to 'content/fetchers/file.c')
-rw-r--r-- | content/fetchers/file.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/content/fetchers/file.c b/content/fetchers/file.c index 2f69fe583..9cdc21054 100644 --- a/content/fetchers/file.c +++ b/content/fetchers/file.c @@ -599,10 +599,6 @@ static void fetch_file_poll(const char *scheme) /* Iterate over ring, processing each pending fetch */ c = ring; do { - /* Take a copy of the next pointer as we may destroy - * the ring item we're currently processing */ - next = c->r_next; - /* Ignore fetches that have been flagged as locked. * This allows safe re-entrant calls to this function. * Re-entrancy can occur if, as a result of a callback, @@ -610,6 +606,7 @@ static void fetch_file_poll(const char *scheme) * again. */ if (c->locked == true) { + next = c->r_next; continue; } @@ -619,6 +616,10 @@ static void fetch_file_poll(const char *scheme) fetch_file_process(c); } + /* Compute next fetch item at the last possible moment as + * processing this item may have added to the ring. + */ + next = c->r_next; fetch_remove_from_queues(c->fetchh); fetch_free(c->fetchh); |