From 1eccfb8c77e61580066737a7f87b23fdd68e4740 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sun, 21 Jul 2024 20:00:01 -0400 Subject: [PATCH] duckdns: Invert condition to improve readability --- ddclient.in | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ddclient.in b/ddclient.in index d8ef014..81f0a66 100755 --- a/ddclient.in +++ b/ddclient.in @@ -6360,19 +6360,19 @@ sub nic_duckdns_update { next; }; chomp($body); - if ($body eq 'OK') { - $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; - success("updating %s: good: IPv4 address set to %s", $h, $ipv4) if $ipv4; - success("updating %s: good: IPv6 address set to %s", $h, $ipv6) if $ipv6; - } else { + if ($body ne 'OK') { $config{$h}{'status-ipv4'} = 'failed' if $ipv4; $config{$h}{'status-ipv6'} = 'failed' if $ipv6; failed("updating %s: Server said: '%s'", $h, $body); + next; } + $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; + success("updating %s: good: IPv4 address set to %s", $h, $ipv4) if $ipv4; + success("updating %s: good: IPv6 address set to %s", $h, $ipv6) if $ipv6; } }