Supplement logical assumption assert with error message

This commit is contained in:
Darshit Shah 2014-11-22 14:23:12 +05:30
parent ed996fe32f
commit cd23c7fe0e
2 changed files with 12 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2014-11-22 Darshit Shah <darnir@gmail.com>
* hosts.c (address_list_set_faulty): Add a helpful error message for when a
logical assumption fails
2014-11-22 Darshit Shah <darnir@gmail.com>
* cookies.c (discard_matching_cookie): Replace defensive assert with a

View File

@ -151,6 +151,13 @@ address_list_set_faulty (struct address_list *al, int index)
"faulty" attempt is always preceded with all-faulty addresses,
and this is how Wget uses it. */
assert (index == al->faulty);
if (index != al->faulty)
{
logprintf (LOG_ALWAYS, "index: %d\nal->faulty: %d\n", index, al->faulty);
logprintf (LOG_ALWAYS, _("Error in handling the address list.\n"));
logprintf (LOG_ALWAYS, _("Please report this issue to bug-wget@gnu.org\n"));
abort();
}
++al->faulty;
if (al->faulty >= al->count)