Changeset 3432

Show
Ignore:
Timestamp:
03/17/10 09:01:30 (2 years ago)
Author:
steve.schnepp
Message:

use Clone to deepclone the $config, in order to make .sum work again (see #894)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/master/lib/Munin/Master/GraphOld.pm

    r3421 r3432  
    4343@ISA    = qw(Exporter); 
    4444@EXPORT = qw(graph_startup graph_check_cron graph_main); 
     45 
     46use Clone qw(clone); 
    4547 
    4648use IO::Socket; 
     
    163165# "global" Configuration hash 
    164166my $config; 
     167my $config_bak; 
    165168 
    166169# stats file handle 
     
    251254    # Only read $config once (thx Jani M.) 
    252255    # TODO - should maybe stat() the conf file to dyna reload the conf 
    253     $config = &munin_config($conffile) if ! $config; 
     256    if (! $config) { 
     257        $config = &munin_config($conffile); 
     258        $config_bak = clone($config); 
     259    } else { 
     260        undef_references($config); 
     261        $config = clone($config_bak); 
     262    } 
    254263 
    255264    # untaint the $log_file variable 
     
    287296} 
    288297 
     298sub undef_references { 
     299    my ($c) = @_; 
     300    foreach my $k (keys %$c) { 
     301        undef_references($c->{$k}) if (ref($c->{$k}) eq "HASH" && $k ne "#%#parent"); 
     302        $c->{$k} = undef; 
     303    } 
     304} 
    289305 
    290306sub graph_check_cron {