Improve save_config()
FossilOrigin-Name: 99d62ede397dea67cc9f7d6b5f4b6e3c8159a693c4dff023abac21440a72e486
This commit is contained in:
parent
dbb0341660
commit
1b07818e6a
1 changed files with 6 additions and 5 deletions
11
shelldap
11
shelldap
|
|
@ -2608,13 +2608,14 @@ sub save_config
|
|||
{
|
||||
my $confpath = shift;
|
||||
|
||||
my %conf2 = %$conf;
|
||||
if( $confpath eq $conf->{configfile}) {
|
||||
delete $conf2{'configfile'}
|
||||
# This check is currently unnecessary because the comparison will always
|
||||
# be true, but is left here for effect of least surprise in the future.
|
||||
if( defined($conf->{'configfile'}) and ($confpath eq $conf->{'configfile'})) {
|
||||
delete $conf->{'configfile'}
|
||||
}
|
||||
|
||||
YAML::Syck::DumpFile( $conf->{'configfile'}, \%conf2 );
|
||||
chmod 0600, $conf->{'configfile'};
|
||||
YAML::Syck::DumpFile( $confpath, $conf );
|
||||
chmod 0600, $confpath;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue