summaryrefslogtreecommitdiffstats
path: root/perl-install/security/msec.pm
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2004-02-10 17:04:07 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2004-02-10 17:04:07 +0000
commit8a70f60c5738b82c01abf041d0257c6ca320c0c2 (patch)
tree6d1b53fff6fa3a5f47237ae7f9e62c4784f8f02c /perl-install/security/msec.pm
parentcfb7919bba71f65aaaf0bb5f1c4a42bd27355a61 (diff)
downloaddrakx-8a70f60c5738b82c01abf041d0257c6ca320c0c2.tar
drakx-8a70f60c5738b82c01abf041d0257c6ca320c0c2.tar.gz
drakx-8a70f60c5738b82c01abf041d0257c6ca320c0c2.tar.bz2
drakx-8a70f60c5738b82c01abf041d0257c6ca320c0c2.tar.xz
drakx-8a70f60c5738b82c01abf041d0257c6ca320c0c2.zip
(apply_checks) fix unable to save checks when config file is empty
(aka substInFile does not support using print in that case)
Diffstat (limited to 'perl-install/security/msec.pm')
-rw-r--r--perl-install/security/msec.pm18
1 files changed, 8 insertions, 10 deletions
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 {