From: adrian <> Date: Sat, 18 Nov 2000 17:46:32 +0000 (+0000) Subject: Don't return NULL in createRemovalPolicy() if there is no match for X-Git-Tag: SQUID_3_0_PRE1~1763 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0c5ccf11f88699938dd8ab9e7edc3eb5ea0de7d5;p=thirdparty%2Fsquid.git Don't return NULL in createRemovalPolicy() if there is no match for 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. --- diff --git a/src/store.cc b/src/store.cc index b38c0ae544..3bc52b6e92 100644 --- a/src/store.cc +++ b/src/store.cc @@ -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