]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug #1209: Squid 3.0 segfaults when requesting mgr:config
authorserassio <>
Sun, 6 Feb 2005 05:02:32 +0000 (05:02 +0000)
committerserassio <>
Sun, 6 Feb 2005 05:02:32 +0000 (05:02 +0000)
Patch from Gonzalo Arana

src/fs/coss/CossSwapDir.h
src/fs/coss/store_dir_coss.cc
src/fs/ufs/store_dir_ufs.cc
src/fs/ufs/ufscommon.h

index 8f25cc5afc12a65b705cfc54bfbb9a867d026b89..6822e9dd9ce33dbc65c89746922649b31484a1c6 100644 (file)
@@ -88,7 +88,7 @@ private:
     char const *stripePath() const;
     ConfigOption * getOptionTree() const;
     const char *ioModule;
-    ConfigOptionVector *currentIOOptions;
+    mutable ConfigOptionVector *currentIOOptions;
     const char *stripe_path;
 };
 
index 5f399a6d6d5a19682ff6142b42b78beca30e8ede..816e302ac1e9a682cd3a12a96ff7d14475bba7bc 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir_coss.cc,v 1.59 2005/01/06 14:09:26 serassio Exp $
+ * $Id: store_dir_coss.cc,v 1.60 2005/02/05 22:02:32 serassio Exp $
  * vim: set et : 
  *
  * DEBUG: section 47    Store COSS Directory Routines
@@ -259,6 +259,9 @@ CossSwapDir::changeIO(DiskIOModule *module)
     io = anIO;
     /* Change the IO Options */
 
+    if (currentIOOptions == NULL)
+        currentIOOptions = new ConfigOptionVector();
+
     if (currentIOOptions->options.size() > 3)
         delete currentIOOptions->options.pop_back();
 
@@ -306,8 +309,13 @@ CossSwapDir::getOptionTree() const
 {
     ConfigOption *parentResult = SwapDir::getOptionTree();
 
+    if (currentIOOptions == NULL)
+        currentIOOptions = new ConfigOptionVector();
+
     currentIOOptions->options.push_back(parentResult);
+
     currentIOOptions->options.push_back(new ConfigOptionAdapter<CossSwapDir>(*const_cast<CossSwapDir *>(this), &CossSwapDir::optionIOParse, &CossSwapDir::optionIODump));
+
     currentIOOptions->options.push_back(
         new ConfigOptionAdapter<CossSwapDir>(*const_cast<CossSwapDir *>(this),
                                              &CossSwapDir::optionBlockSizeParse,
@@ -322,7 +330,11 @@ CossSwapDir::getOptionTree() const
     if (ioOptions)
         currentIOOptions->options.push_back(ioOptions);
 
-    return currentIOOptions;
+    ConfigOption* result = currentIOOptions;
+
+    currentIOOptions = NULL;
+
+    return result;
 }
 
 void
index 30eb81b7c9d56e5405c0cddf36cef44e90684648..a59c1a07d17466a24de0467d9f630a86dde62b44 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir_ufs.cc,v 1.68 2005/01/03 16:08:27 robertc Exp $
+ * $Id: store_dir_ufs.cc,v 1.69 2005/02/05 22:02:32 serassio Exp $
  *
  * DEBUG: section 47    Store Directory Routines
  * AUTHOR: Duane Wessels
@@ -188,7 +188,11 @@ UFSSwapDir::getOptionTree() const
 {
     ConfigOption *parentResult = SwapDir::getOptionTree();
 
+    if (currentIOOptions == NULL)
+        currentIOOptions = new ConfigOptionVector();
+
     currentIOOptions->options.push_back(parentResult);
+
     currentIOOptions->options.push_back(new ConfigOptionAdapter<UFSSwapDir>(*const_cast<UFSSwapDir *>(this), &UFSSwapDir::optionIOParse, &UFSSwapDir::optionIODump));
 
     ConfigOption *ioOptions  = IO->io->getOptionTree();
@@ -196,7 +200,11 @@ UFSSwapDir::getOptionTree() const
     if (ioOptions)
         currentIOOptions->options.push_back(ioOptions);
 
-    return currentIOOptions;
+    ConfigOption* result = currentIOOptions;
+
+    currentIOOptions = NULL;
+
+    return result;
 }
 
 /*
index 06830516bd261086dedd4dfefa1931994fef6984..a400fee258d9ff5c8755200c0e41e02bb9f3ee00 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ufscommon.h,v 1.2 2005/01/03 16:08:27 robertc Exp $
+ * $Id: ufscommon.h,v 1.3 2005/02/05 22:02:32 serassio Exp $
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
  * ----------------------------------------------------------
@@ -139,7 +139,7 @@ private:
     void changeIO(DiskIOModule *);
     bool optionIOParse(char const *option, const char *value, int reconfiguring);
     void optionIODump(StoreEntry * e) const;
-    ConfigOptionVector *currentIOOptions;
+    mutable ConfigOptionVector *currentIOOptions;
     char const *ioType;
 
 };