From 21ed32c89058587cf5ec2f72cc795108cf996427 Mon Sep 17 00:00:00 2001 From: Francesco Giudici Date: Mon, 2 Dec 2024 23:34:12 +0100 Subject: [PATCH] set: when doing an update loop, exit on error this is required to honor the dyndns protocol specification: when errors are detected in the conf, no update should automatically retried till the user has changed the config Signed-off-by: Francesco Giudici --- cmd/set.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/set.go b/cmd/set.go index 82407c1..669ec13 100644 --- a/cmd/set.go +++ b/cmd/set.go @@ -110,12 +110,12 @@ func newSetCommand() *cli.Command { for { if err = updateFQDN(ddns, conf); err != nil { slog.Error("FQDN update failed", "fqdn", conf.fqdn, "ip", conf.address, "error", err) - } else { - slog.Info("FQDN update successful", "fqdn", conf.fqdn, "ip", conf.address) + return err } + slog.Info("FQDN update successful", "fqdn", conf.fqdn, "ip", conf.address) if conf.interval == 0 { - return err + return nil } time.Sleep(conf.interval) }