------------------------------------------------------------ revno: 13589 revision-id: squid3@treenet.co.nz-20140915012136-mjnrgxjemllxh2xd parent: squid3@treenet.co.nz-20140915005729-v02shmottaem2yzx committer: Amos Jeffries branch nick: trunk timestamp: Sun 2014-09-14 18:21:36 -0700 message: Cygwin: re-enable /etc/resolv.conf parsing idnsParseResolvConf() had been disabled for all windows builds. Cygwin does provide this system config file. Also, instead of seeding #if/#endif wrappers around always call the function and just wrap its internals away from Windows builds that do not supply the necessary config file. ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20140915012136-mjnrgxjemllxh2xd # target_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # testament_sha1: 632cb3752780d2dc47601f9bc9ed1587b7ebc1a9 # timestamp: 2014-09-15 10:53:25 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # base_revision_id: squid3@treenet.co.nz-20140915005729-\ # v02shmottaem2yzx # # Begin patch === modified file 'src/dns_internal.cc' --- src/dns_internal.cc 2014-09-13 13:59:43 +0000 +++ src/dns_internal.cc 2014-09-15 01:21:36 +0000 @@ -212,9 +212,7 @@ static void idnsFreeNameservers(void); static void idnsFreeSearchpath(void); static bool idnsParseNameservers(void); -#if _SQUID_WINDOWS_ static bool idnsParseResolvConf(void); -#endif #if _SQUID_WINDOWS_ static bool idnsParseWIN32Registry(void); static void idnsParseWIN32SearchList(const char *); @@ -379,15 +377,12 @@ return result; } -#if !_SQUID_WINDOWS_ static bool idnsParseResolvConf(void) { - FILE *fp; - char buf[RESOLV_BUFSZ]; - const char *t; bool result = false; - fp = fopen(_PATH_RESCONF, "r"); +#if !_SQUID_WINDOWS_ || _SQUID_CYGWIN_ + FILE *fp = fopen(_PATH_RESCONF, "r"); if (fp == NULL) { debugs(78, DBG_IMPORTANT, "" << _PATH_RESCONF << ": " << xstrerror()); @@ -398,6 +393,8 @@ setmode(fileno(fp), O_TEXT); #endif + char buf[RESOLV_BUFSZ]; + const char *t = NULL; while (fgets(buf, RESOLV_BUFSZ, fp)) { t = strtok(buf, w_space); @@ -460,11 +457,10 @@ } fclose(fp); +#endif return result; } -#endif - #if _SQUID_WINDOWS_ static void idnsParseWIN32SearchList(const char * Separator) @@ -1568,12 +1564,10 @@ assert(0 == nns); idnsAddMDNSNameservers(); bool nsFound = idnsParseNameservers(); -#if !_SQUID_WINDOWS_ if (!nsFound) nsFound = idnsParseResolvConf(); -#endif #if _SQUID_WINDOWS_ if (!nsFound) nsFound = idnsParseWIN32Registry();