From: Amos Jeffries Date: Mon, 15 Sep 2014 01:21:36 +0000 (-0700) Subject: Cygwin: re-enable /etc/resolv.conf parsing X-Git-Tag: SQUID_3_5_0_1~56 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aa0ca030da41a6535ff6c8415829ba1367fe011b;p=thirdparty%2Fsquid.git 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. --- diff --git a/src/dns_internal.cc b/src/dns_internal.cc index 21b832b3af..8650537dc8 100644 --- a/src/dns_internal.cc +++ b/src/dns_internal.cc @@ -212,9 +212,7 @@ static void idnsAddPathComponent(const char *buf); 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 @@ idnsParseNameservers(void) 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 @@ idnsParseResolvConf(void) 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 @@ idnsParseResolvConf(void) } fclose(fp); +#endif return result; } -#endif - #if _SQUID_WINDOWS_ static void idnsParseWIN32SearchList(const char * Separator) @@ -1568,12 +1564,10 @@ dnsInit(void) assert(0 == nns); idnsAddMDNSNameservers(); bool nsFound = idnsParseNameservers(); -#if !_SQUID_WINDOWS_ if (!nsFound) nsFound = idnsParseResolvConf(); -#endif #if _SQUID_WINDOWS_ if (!nsFound) nsFound = idnsParseWIN32Registry();