From f0dbdcff9d3c6764f6a9d4476362aa1f53fdc6d6 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 3 Aug 2009 11:29:17 +0000 Subject: - Joshua Kwan fixed the init routine to fill in the defaults for stuff that fails to get inited by other means. This fixes a case of when the c-ares init fails when internet access is fone. --- ares/CHANGES | 5 +++++ ares/RELEASE-NOTES | 3 ++- ares/ares_init.c | 15 +++++++++------ 3 files changed, 16 insertions(+), 7 deletions(-) (limited to 'ares') diff --git a/ares/CHANGES b/ares/CHANGES index e7b3b8d70..c61e31929 100644 --- a/ares/CHANGES +++ b/ares/CHANGES @@ -1,5 +1,10 @@ Changelog for the c-ares project +* 3 Aug 2009 (Daniel Stenberg) +- Joshua Kwan fixed the init routine to fill in the defaults for stuff that + fails to get inited by other means. This fixes a case of when the c-ares + init fails when internet access is fone. + * 14 Jul 2009 (Guenter Knauf) - renamed generated config.h to ares_config.h to avoid any future clashes with config.h from other projects. diff --git a/ares/RELEASE-NOTES b/ares/RELEASE-NOTES index c1e23d641..c144d1c73 100644 --- a/ares/RELEASE-NOTES +++ b/ares/RELEASE-NOTES @@ -16,9 +16,10 @@ Fixed: ARES_EBADNAME if the name in the response failed to decode o only expose/export symbols starting with 'ares_' o fix \Device\TCP handle leaks triggered by buggy iphlpapi.dll + o init without internet gone no longer fails Thanks go to these friendly people for their efforts and contributions: - Phil Blundell, Japheth Cleaver, Yang Tse, Gregor Jasny + Phil Blundell, Japheth Cleaver, Yang Tse, Gregor Jasny, Joshua Kwan Have fun! diff --git a/ares/ares_init.c b/ares/ares_init.c index bd29fe94f..e04cfddb7 100644 --- a/ares/ares_init.c +++ b/ares/ares_init.c @@ -201,12 +201,15 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, DEBUGF(fprintf(stderr, "Error: init_by_resolv_conf failed: %s\n", ares_strerror(status))); } - if (status == ARES_SUCCESS) { - status = init_by_defaults(channel); - if (status != ARES_SUCCESS) - DEBUGF(fprintf(stderr, "Error: init_by_defaults failed: %s\n", - ares_strerror(status))); - } + + /* + * No matter what failed or succeeded, seed defaults to provide + * useful behavior for things that we missed. + */ + status = init_by_defaults(channel); + if (status != ARES_SUCCESS) + DEBUGF(fprintf(stderr, "Error: init_by_defaults failed: %s\n", + ares_strerror(status))); /* Generate random key */ -- cgit v1.2.3