]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Display ERROR in cache.log for invalid configured paths
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 18 Apr 2011 11:00:10 +0000 (05:00 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 18 Apr 2011 11:00:10 +0000 (05:00 -0600)
The validator that checks system paths for files and directories in the
configuration file sends error messages to stderr. It should send them to
cache.log for the admin to see easily.

Also, this makes the error display as FATAL ERROR when using -k parse to
indicate that it is fatal to the startup. Other management signals where
it is not necessarily fatal will only display as an ERROR.

src/cache_cf.cc

index 310ed112dc31c21947cf30b1a500cc54efab27e6..fcbc93c017b1c010f9a17b1d6eb2b9dc95c81281 100644 (file)
@@ -3588,10 +3588,13 @@ requirePathnameExists(const char *name, const char *path)
     }
 
     if (stat(path, &sb) < 0) {
+        debugs(0, DBG_CRITICAL, (opt_parse_cfg_only?"FATAL ":"") << "ERROR: " << name << " " << path << ": " << xstrerror());
+        // keep going to find more issues if we are only checking the config file with "-k parse"
+        if (opt_parse_cfg_only)
+            return;
+        // this is fatal if it is found during startup or reconfigure
         if (opt_send_signal == -1 || opt_send_signal == SIGHUP)
             fatalf("%s %s: %s", name, path, xstrerror());
-        else
-            fprintf(stderr, "WARNING: %s %s: %s\n", name, path, xstrerror());
     }
 }