From 8a70f60c5738b82c01abf041d0257c6ca320c0c2 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Tue, 10 Feb 2004 17:04:07 +0000 Subject: (apply_checks) fix unable to save checks when config file is empty (aka substInFile does not support using print in that case) --- perl-install/security/msec.pm | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'perl-install/security') diff --git a/perl-install/security/msec.pm b/perl-install/security/msec.pm index 87554dea0..b880ce346 100644 --- a/perl-install/security/msec.pm +++ b/perl-install/security/msec.pm @@ -148,16 +148,14 @@ sub apply_functions { sub apply_checks { my ($msec) = @_; my @list = sort $msec->raw_checks_list; - touch($msec->{checks}{values_file}) if !-e $msec->{checks}{values_file}; - substInFile { - foreach my $check (@list) { s/^$check.*\n// } - if (eof) { - print "\n", join("\n", map { - my $value = $msec->get_check_value($_); - if_($value ne 'default', $_ . '=' . $value); - } @list), "\n"; - } - } $msec->{checks}{values_file}; + setVarsInSh($msec->{checks}{values_file}, + { + map { + my $value = $msec->get_check_value($_); + if_($value ne 'default', $_ => $value); + } @list + } + ); } sub reload { -- cgit v1.2.1