]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Display ERROR in cache.log for invalid configured paths
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 5 Apr 2011 13:04:11 +0000 (01:04 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 5 Apr 2011 13:04:11 +0000 (01:04 +1200)
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 7b5ae5be24de13bc963f5487eeb1921fc16fb9f2..dae538b9f6943c4ea7e7d1143608108e89505f3f 100644 (file)
@@ -4027,10 +4027,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());
     }
 }