]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Don't return NULL in createRemovalPolicy() if there is no match for
authoradrian <>
Sat, 18 Nov 2000 17:46:32 +0000 (17:46 +0000)
committeradrian <>
Sat, 18 Nov 2000 17:46:32 +0000 (17:46 +0000)
the given policy type. None of the FS code handles this correctly,
and it was causing SIGSEGVs when a cache_replacement_policy was not
set in squid.conf, defaulting to lru, and lru was not compiled in.

We now warn very loudly and die with an error. cache.log will tell the
user to check cache_replacement_policy and memory_replacement_policy
in their squid.conf file.

src/store.cc

index b38c0ae5442803d8d76468768f5438fac6807e7d..3bc52b6e9201fcc892018d414fa0dd0f6e2e637a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store.cc,v 1.531 2000/10/31 23:48:14 wessels Exp $
+ * $Id: store.cc,v 1.532 2000/11/18 10:46:32 adrian Exp $
  *
  * DEBUG: section 20    Storage Manager
  * AUTHOR: Harvest Derived
@@ -1292,8 +1292,10 @@ createRemovalPolicy(RemovalPolicySettings * settings)
        if (strcmp(r->typestr, settings->type) == 0)
            return r->create(settings->args);
     }
-    debug(20, 1) ("Unknown policy %s\n", settings->type);
-    return NULL;
+    debug(20, 1) ("ERROR: Unknown policy %s\n", settings->type);
+    debug(20, 1) ("ERROR: Be sure to have set cache_replacement_policy\n");
+    debug(20, 1) ("ERROR:   and memory_replacement_policy in squid.conf!\n");
+    fatalf("ERROR: Unknown policy %s\n", settings->type);
 }
 
 #if 0