Cleanup code that checks the cache

This commit is contained in:
Jamie Cameron
2025-01-29 20:39:57 -08:00
parent 6e6c9c26c7
commit 60ce4c81fe

View File

@@ -2479,24 +2479,27 @@ foreach my $h (@{$_[0]}) {
# built from the primary configuration.
sub list_zone_names
{
my @st = stat($zone_names_cache);
my %znc;
&read_file_cached_with_stat($zone_names_cache, \%znc);
# Check if any files have changed, or if the master config has changed, or
# the PID file.
my %files;
my (%files, %znc);
my ($changed, $filecount, %donefile);
foreach my $k (keys %znc) {
if ($k =~ /^file_(.*)$/) {
$filecount++;
$donefile{$1}++;
my @fst = stat($1);
if (!@st || !@fst || $fst[9] > $st[9]) {
$changed = 1;
my @st = stat($zone_names_cache);
if (@st) {
&read_file_cached_with_stat($zone_names_cache, \%znc);
foreach my $k (keys %znc) {
if ($k =~ /^file_(.*)$/) {
$filecount++;
$donefile{$1}++;
my @fst = stat($1);
if (!@fst || $fst[9] > $st[9]) {
$changed = 1;
}
}
}
}
else {
$changed = 1;
}
if ($changed || !$znc{'version'} ||
$znc{'version'} != $zone_names_version ||
int($config{'no_chroot'}) != int($znc{'no_chroot_config'}) ||