From 99da7eded2328b3a1c81af721391d7802dda8a4b Mon Sep 17 00:00:00 2001 From: Paul Donald Date: Sat, 30 Nov 2024 16:46:39 +0100 Subject: [PATCH] ddns-scripts: refactor stop_daemon_for_all_ddns_sections() Same functionality - code reads less 'shouty' and 'stabby'. Signed-off-by: Paul Donald --- .../files/usr/lib/ddns/dynamic_dns_functions.sh | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh b/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh index ba1572ec67..5d15cbef7b 100644 --- a/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh +++ b/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh @@ -220,16 +220,14 @@ stop_section_processes() { # and by /etc/init.d/ddns stop # needed because we also need to kill "sleep" child processes stop_daemon_for_all_ddns_sections() { - local __EVENTIF="$1" - local __SECTIONS="" - local __SECTIONID="" - local __IFACE="" + local event_if sections section_id configured_if + event_if="$1" - load_all_service_sections __SECTIONS - for __SECTIONID in $__SECTIONS; do - config_get __IFACE "$__SECTIONID" interface "wan" - [ -z "$__EVENTIF" -o "$__IFACE" = "$__EVENTIF" ] || continue - stop_section_processes "$__SECTIONID" + load_all_service_sections sections + for section_id in $sections; do + config_get configured_if "$section_id" interface "wan" + [ -z "$event_if" ] || [ "$configured_if" = "$event_if" ] || continue + stop_section_processes "$section_id" done }