]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 4707: purge tool does not obey --sysconfdir= build option (#210)
authorAmos Jeffries <yadij@users.noreply.github.com>
Tue, 22 May 2018 12:55:35 +0000 (12:55 +0000)
committerAmos Jeffries <yadij@users.noreply.github.com>
Wed, 23 May 2018 20:11:58 +0000 (08:11 +1200)
The purge tool was still using DEFAULT_SQUID_CONF macro from
before it was bundled with Squid, which had no connection to our
./configure script.

Update it to the DEFAULT_CONFIG_FILE macro used by other Squid
binaries and fix some existing issues with that macro's use by
binaries outside 'squid'.

src/Common.am
src/Makefile.am
src/WinSvc.cc
src/globals.h
src/icmp/Makefile.am
src/main.cc
tools/purge/conffile.hh
tools/purge/purge.cc

index 1ff831d6c50c8edcfb52a619e1776f64202eae82..3ec9ccc79e7a64c1f49cfd3c9c7f43bbc328774b 100644 (file)
@@ -36,6 +36,11 @@ AM_CFLAGS = $(SQUID_CFLAGS)
 AM_CXXFLAGS = $(SQUID_CXXFLAGS)
 DEFS = @DEFS@
 
+# Make ./configure location settings above available to the code
+DEFS += -DDEFAULT_CONFIG_FILE=\"$(DEFAULT_CONFIG_FILE)\" \
+       -DDEFAULT_SQUID_DATA_DIR=\"$(datadir)\" \
+       -DDEFAULT_SQUID_CONFIG_DIR=\"$(sysconfdir)\"
+
 ## so that others can always use += for these variables
 CLEANFILES =
 check_PROGRAMS = 
index acc0520089107d47ff057a6de0f91c9fd4c1f18d..5467f5a71378431fb41fe353c072e53277e66525 100644 (file)
@@ -728,9 +728,6 @@ EXTRA_DIST = \
        mib.txt \
        mime.conf.default
 
-# Make location configure settings available to the code
-DEFS += -DDEFAULT_CONFIG_FILE=\"$(DEFAULT_CONFIG_FILE)\" -DDEFAULT_SQUID_DATA_DIR=\"$(datadir)\" -DDEFAULT_SQUID_CONFIG_DIR=\"$(sysconfdir)\"
-
 snmp_core.o snmp_agent.o: ../lib/snmplib/libsnmplib.la $(top_srcdir)/include/cache_snmp.h
 
 globals.cc: globals.h mk-globals-c.awk
index 685fef196f50028a0bbf459a4e7329b4eff2de20..60432434f851ee336c7f1197eade945b5a34bb99 100644 (file)
@@ -517,7 +517,7 @@ int WIN32_Subsystem_Init(int * argc, char *** argv)
                 ConfigFile = static_cast<char *>(xmalloc(Size));
                 RegQueryValueEx(hndKey, CONFIGFILE, NULL, &Type, (unsigned char *)ConfigFile, &Size);
             } else
-                ConfigFile = xstrdup(DefaultConfigFile);
+                ConfigFile = xstrdup(DEFAULT_CONFIG_FILE);
 
             Size = 0;
 
@@ -533,7 +533,7 @@ int WIN32_Subsystem_Init(int * argc, char *** argv)
 
             RegCloseKey(hndKey);
         } else {
-            ConfigFile = xstrdup(DefaultConfigFile);
+            ConfigFile = xstrdup(DEFAULT_CONFIG_FILE);
             WIN32_Service_Command_Line = xstrdup("");
         }
 
@@ -778,7 +778,7 @@ WIN32_InstallService()
             /* Now store the config file location in the registry */
 
             if (!ConfigFile)
-                ConfigFile = xstrdup(DefaultConfigFile);
+                ConfigFile = xstrdup(DEFAULT_CONFIG_FILE);
 
             WIN32_StoreKey(CONFIGFILE, REG_SZ, (unsigned char *) ConfigFile, strlen(ConfigFile) + 1);
 
index 588c8a0d5f38666088ba406c9b5b84649a56a2f5..b8b4ef0d4e5adb4212dabdad7588b87cf4ebff0a 100644 (file)
@@ -24,7 +24,6 @@ extern char ThisCache2[RFC2181_MAXHOSTNAMELEN << 1];
 extern char config_input_line[BUFSIZ];
 /// During parsing, the name of the current squid.conf directive being parsed.
 extern const char *cfg_directive; /* NULL */
-extern const char *DefaultConfigFile;   /* DEFAULT_CONFIG_FILE */
 extern const char *cfg_filename;    /* NULL */
 extern const char *dash_str;    /* "-" */
 extern const char *null_string; /* "" */
index d8f61d30d5b86a6490ef175191b30e94ddfd6585..98b4f0137a480091151e78dba5820fefacbba53d 100644 (file)
@@ -8,11 +8,6 @@
 include $(top_srcdir)/src/Common.am
 include $(top_srcdir)/src/TestHeaders.am
 
-# TODO: get rid of this when config filename is no longer a global constant.
-#      its only here so the pinger globals.cc will link.
-DEFS += -DDEFAULT_CONFIG_FILE=NULL
-
-
 # ICMP Specific Configurations
 
 if ENABLE_PINGER
index 0e17be587cb689ee17e3c589b98602ebe4ea1595..19f096fe4457e5b835d8f8c1fad6bdb16c8b8fcc 100644 (file)
@@ -406,7 +406,7 @@ usage(void)
             "       -S        Double-check swap during rebuild.\n"
             "       -X        Force full debugging.\n"
             "       -Y        Only return UDP_HIT or UDP_MISS_NOFETCH during fast reload.\n",
-            APP_SHORTNAME, CACHE_HTTP_PORT, DefaultConfigFile, CACHE_ICP_PORT);
+            APP_SHORTNAME, CACHE_HTTP_PORT, DEFAULT_CONFIG_FILE, CACHE_ICP_PORT);
     exit(EXIT_FAILURE);
 }
 
@@ -1540,7 +1540,7 @@ SquidMain(int argc, char **argv)
         int parse_err;
 
         if (!ConfigFile)
-            ConfigFile = xstrdup(DefaultConfigFile);
+            ConfigFile = xstrdup(DEFAULT_CONFIG_FILE);
 
         assert(!configured_once);
 
index 055730b34a621497dcfeeb098016981505546a18..7edfdb1ad26a1d57ab28c61fcf8daf7719d5ca41 100644 (file)
@@ -55,11 +55,6 @@ typedef int bool;
 #endif
 #endif /* __cplusplus */
 
-
-#if !defined(DEFAULT_SQUID_CONF)
-#define DEFAULT_SQUID_CONF "/usr/local/squid/etc/squid.conf"
-#endif
-
 #include <vector>
 
 struct CacheDir {
@@ -75,7 +70,7 @@ typedef std::vector<CacheDir> CacheDirVector;
 
 int
 readConfigFile( CacheDirVector& cachedir, 
-               const char* fn = DEFAULT_SQUID_CONF, 
+               const char* fn,
                FILE* debug = 0 );
   // purpose: read squid.conf file and extract cache_dir entries
   // paramtr: cachedir (OUT): vector with an entry for each cache_dir found
index b2339b4ce68e98d198ef047be5b6284b2284c6e5..321ff74bae56fc5415c4a32fdc26de49f72fd4a8 100644 (file)
@@ -615,7 +615,7 @@ helpMe( void )
         "\t0 and 1 are recommended - slow rebuild your cache with other modes.\n"
         " -s\tshow all options after option parsing, but before really starting.\n"
         " -v\tshow more information about the file, e.g. MD5, timestamps and flags.\n"
-        "\n", DEFAULT_SQUID_CONF, DEFAULTHOST, DEFAULTPORT );
+        "\n", DEFAULT_CONFIG_FILE, DEFAULTHOST, DEFAULTPORT );
 
 }
 
@@ -890,7 +890,7 @@ main( int argc, char* argv[] )
 {
     // setup variables
     REList* list = 0;
-    char* conffile = xstrdup( DEFAULT_SQUID_CONF );
+    char* conffile = xstrdup(DEFAULT_CONFIG_FILE);
     serverPort = htons(DEFAULTPORT);
     if ( convertHostname(DEFAULTHOST,serverHost) == -1 ) {
         fprintf( stderr, "unable to resolve host %s!\n", DEFAULTHOST );