From eb0c96b26eef5150291fe1471210c752631bde62 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Thu, 5 Feb 2009 17:34:59 +0000 Subject: [PATCH] Fix caching of config file --- logrotate/logrotate-lib.pl | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/logrotate/logrotate-lib.pl b/logrotate/logrotate-lib.pl index 92766ff88..b22db2c32 100644 --- a/logrotate/logrotate-lib.pl +++ b/logrotate/logrotate-lib.pl @@ -33,12 +33,13 @@ return $get_config_parent_cache; # Returns a list of logrotate config file entries sub get_config { -if (!$_[0] && $get_config_cache) { - return wantarray ? ( $get_config_cache, $get_config_lnum_cache, - $get_config_files_cache ) - : $get_config_cache; - } local $file = $_[0] || $config{'logrotate_conf'}; +if (!$_[0] && $get_config_cache{$file}) { + return wantarray ? ( $get_config_cache{$file}, + $get_config_lnum_cache{$file}, + $get_config_files_cache{$file} ) + : $get_config_cache{$file}; + } local @files = ( $file ); local @rv; local $addto = \@rv; @@ -127,9 +128,9 @@ while(<$fh>) { } close($fh); if (!$_[0]) { - $get_config_cache = \@rv; - $get_config_lnum_cache = $lnum; - $get_config_files_cache = \@files; + $get_config_cache{$file} = \@rv; + $get_config_lnum_cache{$file} = $lnum; + $get_config_files_cache{$file} = \@files; } return wantarray ? (\@rv, $lnum, \@files) : \@rv; }