From e2a8733e623a2fc39abd439774a6489df6db10d0 Mon Sep 17 00:00:00 2001 From: serassio <> Date: Sun, 6 Feb 2005 05:02:32 +0000 Subject: [PATCH] Bug #1209: Squid 3.0 segfaults when requesting mgr:config Patch from Gonzalo Arana --- src/fs/coss/CossSwapDir.h | 2 +- src/fs/coss/store_dir_coss.cc | 16 ++++++++++++++-- src/fs/ufs/store_dir_ufs.cc | 12 ++++++++++-- src/fs/ufs/ufscommon.h | 4 ++-- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/fs/coss/CossSwapDir.h b/src/fs/coss/CossSwapDir.h index 8f25cc5afc..6822e9dd9c 100644 --- a/src/fs/coss/CossSwapDir.h +++ b/src/fs/coss/CossSwapDir.h @@ -88,7 +88,7 @@ private: char const *stripePath() const; ConfigOption * getOptionTree() const; const char *ioModule; - ConfigOptionVector *currentIOOptions; + mutable ConfigOptionVector *currentIOOptions; const char *stripe_path; }; diff --git a/src/fs/coss/store_dir_coss.cc b/src/fs/coss/store_dir_coss.cc index 5f399a6d6d..816e302ac1 100644 --- a/src/fs/coss/store_dir_coss.cc +++ b/src/fs/coss/store_dir_coss.cc @@ -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(*const_cast(this), &CossSwapDir::optionIOParse, &CossSwapDir::optionIODump)); + currentIOOptions->options.push_back( new ConfigOptionAdapter(*const_cast(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 diff --git a/src/fs/ufs/store_dir_ufs.cc b/src/fs/ufs/store_dir_ufs.cc index 30eb81b7c9..a59c1a07d1 100644 --- a/src/fs/ufs/store_dir_ufs.cc +++ b/src/fs/ufs/store_dir_ufs.cc @@ -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(*const_cast(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; } /* diff --git a/src/fs/ufs/ufscommon.h b/src/fs/ufs/ufscommon.h index 06830516bd..a400fee258 100644 --- a/src/fs/ufs/ufscommon.h +++ b/src/fs/ufs/ufscommon.h @@ -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; }; -- 2.47.3