From 8a667e3f57ac5fef7f64eae8e416afcb05e14d8d 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 23d8002..d602229 100755 --- a/ddclient.in +++ b/ddclient.in @@ -4136,6 +4136,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; @@ -4149,18 +4153,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+)(.)/) { # TODO: does not mention # anything about wait statuses. Is this obsolete (this code has been here