From 5b277eb855a40417304acdd849f5c526eb6c297f Mon Sep 17 00:00:00 2001 From: Paul Donald Date: Thu, 28 Nov 2024 03:43:33 +0100 Subject: [PATCH] ddns-scripts: refactor get_uptime() and avoid cat in sub-shell no sub-shell is spawned to get uptime. Signed-off-by: Paul Donald --- .../files/usr/lib/ddns/dynamic_dns_functions.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 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 d64ad8c26b..297388a159 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 @@ -1210,9 +1210,9 @@ get_registered_ip() { get_uptime() { # $1 Variable to store result in - [ $# -ne 1 ] && write_log 12 "Error calling 'verify_host_port()' - wrong number of parameters" - local __UPTIME=$(cat /proc/uptime) - eval "$1=\"${__UPTIME%%.*}\"" + [ $# -ne 1 ] && write_log 12 "Error calling 'get_uptime()' - requires exactly 1 argument." + read -r uptime < /proc/uptime + eval "$1=\"${uptime%%.*}\"" } trap_handler() { -- 2.30.2