From 89d7193f692edfeab442e260cadb5c874305993b Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Fri, 26 Jul 2024 18:15:21 -0400 Subject: [PATCH] nic_updateable: Simplify option changed detection logic --- ddclient.in | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/ddclient.in b/ddclient.in index 5c73b46..c7c58a4 100755 --- a/ddclient.in +++ b/ddclient.in @@ -3709,15 +3709,10 @@ sub nic_updateable { } elsif (defined($force_update) && $force_update->($host)) { $update = 1; - } elsif ((defined($recap{$host}{'static'}) && defined($config{$host}{'static'}) && - ($recap{$host}{'static'} ne $config{$host}{'static'})) || - (defined($recap{$host}{'wildcard'}) && defined($config{$host}{'wildcard'}) && - ($recap{$host}{'wildcard'} ne $config{$host}{'wildcard'})) || - (defined($recap{$host}{'mx'}) && defined($config{$host}{'mx'}) && - ($recap{$host}{'mx'} ne $config{$host}{'mx'})) || - (defined($recap{$host}{'backupmx'}) && defined($config{$host}{'backupmx'}) && - ($recap{$host}{'backupmx'} ne $config{$host}{'backupmx'}))) { - info("updating %s because host settings have been changed.", $host); + } elsif (my @changed = grep({ my $rv = $recap{$host}{$_}; my $cv = $config{$host}{$_}; + defined($rv) && defined($cv) && $rv ne $cv; } + qw(static wildcard mx backupmx))) { + info("$host: update forced because options changed: " . join(', ', @changed)); $update = 1; } else {