From 0882712ec2f79f7ac074902669b31a072aa5ce07 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sat, 13 Jul 2024 04:23:27 -0400 Subject: [PATCH] dyndns2: Treat `nochg` as `good` to eliminate duplicate code --- ddclient.in | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/ddclient.in b/ddclient.in index 4098313..56897a2 100755 --- a/ddclient.in +++ b/ddclient.in @@ -4084,6 +4084,10 @@ sub nic_dyndns2_update { # bug #10: some dyndns providers does not return the IP so # we can't use the returned IP my ($status, $returnedips) = split / /, lc $line; + if ($status eq 'nochg') { + warning("updating %s: %s: %s", $hosts, $status, $errors{$status}); + $status = 'good'; + } for my $h (@hosts) { $config{$h}{'status-ipv4'} = $status if $ipv4; $config{$h}{'status-ipv6'} = $status if $ipv6; @@ -4097,18 +4101,7 @@ sub nic_dyndns2_update { success("updating %s: %s: IPv4 address set to %s", $hosts, $status, $ipv4) if $ipv4; success("updating %s: %s: IPv6 address set to %s", $hosts, $status, $ipv6) if $ipv6; } elsif (exists $errors{$status}) { - if ($status eq 'nochg') { - warning("updating %s: %s: %s", $hosts, $status, $errors{$status}); - for my $h (@hosts) { - $config{$h}{'ipv4'} = $ipv4 if $ipv4; - $config{$h}{'ipv6'} = $ipv6 if $ipv6; - $config{$h}{'mtime'} = $now; - $config{$h}{'status-ipv4'} = 'good' if $ipv4; - $config{$h}{'status-ipv6'} = 'good' if $ipv6; - } - } else { - failed("updating %s: %s: %s", $hosts, $status, $errors{$status}); - } + failed("updating %s: %s: %s", $hosts, $status, $errors{$status}); } elsif ($status =~ /w(\d+)(.)/) { my ($wait, $units) = ($1, lc $2); my ($sec, $scale) = ($wait, 1);