From 1c13c24981b24d13a2677cff9b3747bc21d8f584 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Thu, 4 Jun 2020 18:22:12 -0400 Subject: [PATCH 1/2] Fix misuse of define() --- ddclient | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ddclient b/ddclient index ca158ec..3edecbb 100755 --- a/ddclient +++ b/ddclient @@ -1291,9 +1291,11 @@ sub init_config { $opt{'quiet'} = 0 if opt('verbose'); ## infer the IP strategy if possible - $opt{'use'} = 'ip' if !define($opt{'use'}) && defined($opt{'ip'}); - $opt{'use'} = 'if' if !define($opt{'use'}) && defined($opt{'if'}); - $opt{'use'} = 'web' if !define($opt{'use'}) && defined($opt{'web'}); + if (!defined($opt{'use'})) { + $opt{'use'} = 'ip' if defined($opt{'ip'}); + $opt{'use'} = 'if' if defined($opt{'if'}); + $opt{'use'} = 'web' if defined($opt{'web'}); + } ## sanity check $opt{'max-interval'} = min(interval(opt('max-interval')), interval(default('max-interval'))); From e696d57ff24ceeb6b80535771052a5cb8657a05d Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Thu, 4 Jun 2020 18:23:17 -0400 Subject: [PATCH 2/2] Prefer `ip` over `if` over `web` when inferring `use` If the user passed `-ip` they almost certainly want to use it, even if they also passed `-if` and `-web`. Similarly, if the user passed `-if` they almost certainly want to use it even if they also passed `-web`. --- ChangeLog.md | 3 +++ ddclient | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index a203ee7..6f494ab 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -21,6 +21,9 @@ repository history](https://github.com/ddclient/ddclient/commits/master). minute. * The `pid` option is now ignored when ddclient is not daemonized. * ddclient now gracefully exits when interrupted by Ctrl-C. + * The way ddclient chooses the default for the `use` option has changed. + Rather than rely on the default, users should explicitly set the `use` + option. ## 2020-01-08 v3.9.1 diff --git a/ddclient b/ddclient index 3edecbb..59c5a05 100755 --- a/ddclient +++ b/ddclient @@ -1292,9 +1292,9 @@ sub init_config { ## infer the IP strategy if possible if (!defined($opt{'use'})) { - $opt{'use'} = 'ip' if defined($opt{'ip'}); - $opt{'use'} = 'if' if defined($opt{'if'}); $opt{'use'} = 'web' if defined($opt{'web'}); + $opt{'use'} = 'if' if defined($opt{'if'}); + $opt{'use'} = 'ip' if defined($opt{'ip'}); } ## sanity check