]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Prevent assertion on startup with --enable-replacement-policies
authorAmos Jeffries <squid3@treenet.co.nz>
Sun, 25 Apr 2010 06:58:26 +0000 (18:58 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 25 Apr 2010 06:58:26 +0000 (18:58 +1200)
Option without specific policies listed was asserting on a double-add
for the LRU module.

This just makes duplicate additions a no-op and non-fatal.
No attempt at a cleanup yet.

TODO: sync the repl_modules.cc code with the other dynamic modules init.

src/Makefile.am
src/store.cc

index 554fbde8230a4b30f7bfabba2fc3f5ead88916f5..bc6c17ebe6562bf48295dc5b3404062715f61564 100644 (file)
@@ -753,23 +753,23 @@ DEFS += -DDEFAULT_CONFIG_FILE=\"$(DEFAULT_CONFIG_FILE)\" -DDEFAULT_SQUID_DATA_DI
 snmp_core.o snmp_agent.o: ../snmplib/libsnmp.a $(top_srcdir)/include/cache_snmp.h
 
 globals.cc: globals.h mk-globals-c.awk
-       $(AWK) -f $(srcdir)/mk-globals-c.awk < $(srcdir)/globals.h > $@ || $(RM) -f $@
+       $(AWK) -f $(srcdir)/mk-globals-c.awk < $(srcdir)/globals.h > $@ || ($(RM) -f $@ && exit 1)
 
 ## Generate files containing strng arrays for various enums....
 hier_code.cc: hier_code.h mk-string-arrays.awk
-       $(AWK) -f $(srcdir)/mk-string-arrays.awk < $(srcdir)/hier_code.h > $@ || $(RM) -f $@
+       $(AWK) -f $(srcdir)/mk-string-arrays.awk < $(srcdir)/hier_code.h > $@ || ($(RM) -f $@ && exit 1)
 
 err_type.cc: err_type.h mk-string-arrays.awk
-       $(AWK) -f $(srcdir)/mk-string-arrays.awk < $(srcdir)/err_type.h > $@ || $(RM) -f $@
+       $(AWK) -f $(srcdir)/mk-string-arrays.awk < $(srcdir)/err_type.h > $@ || ($(RM) -f $@ && exit 1)
 
 lookup_t.cc: lookup_t.h mk-string-arrays.awk
-       $(AWK) -f $(srcdir)/mk-string-arrays.awk < $(srcdir)/lookup_t.h > $@ || $(RM) -f $@
+       $(AWK) -f $(srcdir)/mk-string-arrays.awk < $(srcdir)/lookup_t.h > $@ || ($(RM) -f $@ && exit 1)
 
 icp_opcode.cc: icp_opcode.h mk-string-arrays.awk
-       $(AWK) -f $(srcdir)/mk-string-arrays.awk < $(srcdir)/icp_opcode.h > $@ || $(RM) -f $@
+       $(AWK) -f $(srcdir)/mk-string-arrays.awk < $(srcdir)/icp_opcode.h > $@ || ($(RM) -f $@ && exit 1)
 
 swap_log_op.cc: swap_log_op.h mk-string-arrays.awk
-       $(AWK) -f $(srcdir)/mk-string-arrays.awk < $(srcdir)/swap_log_op.h > $@ || $(RM) -f $@
+       $(AWK) -f $(srcdir)/mk-string-arrays.awk < $(srcdir)/swap_log_op.h > $@ || ($(RM) -f $@ && exit 1)
 
 
 ## other generated files...
@@ -791,7 +791,7 @@ cf_parser.h: cf.data cf_gen$(EXEEXT)
        ./cf_gen cf.data $(srcdir)/cf.data.depend
 
 cf_gen_defines.h: $(srcdir)/cf_gen_defines $(srcdir)/cf.data.pre
-       $(AWK) -f $(srcdir)/cf_gen_defines <$(srcdir)/cf.data.pre >$@ || $(RM) -f $@
+       $(AWK) -f $(srcdir)/cf_gen_defines <$(srcdir)/cf.data.pre >$@ || ($(RM) -f $@ && exit 1)
 
 
 ## FIXME: generate a sed command file from configure. Then this doesn't
index f5974a3700b38c5a8f4421f89ff315d8bd66ccd3..5fcea64c76240c63f4669eba9f4e6fe8f7526042 100644 (file)
@@ -1707,10 +1707,13 @@ void
 storeReplAdd(const char *type, REMOVALPOLICYCREATE * create)
 {
     int i;
-    /* find the number of currently known repl types */
 
+    /* find the number of currently known repl types */
     for (i = 0; storerepl_list && storerepl_list[i].typestr; i++) {
-        assert(strcmp(storerepl_list[i].typestr, type) != 0);
+        if (strcmp(storerepl_list[i].typestr, type) == 0) {
+            debugs(20, 1, "WARNING: Trying to load store replacement policy " << type << " twice.");
+            return;
+        }
     }
 
     /* add the new type */