git.99rst.org
/
openwrt-packages.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
| inline |
side by side
(parent:
2bf1916
)
ddns-scripts: refactor get_uptime() and avoid cat in sub-shell
author
Paul Donald
<redacted>
Thu, 28 Nov 2024 02:43:33 +0000
(
03:43
+0100)
committer
Florian Eckert
<redacted>
Thu, 10 Apr 2025 07:34:38 +0000
(09:34 +0200)
no sub-shell is spawned to get uptime.
Signed-off-by: Paul Donald <redacted>
net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh
patch
|
blob
|
history
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 d64ad8c26b251953c6bedde12420b1ac68c89cac..297388a15981fa6e4a286bed77a9345647ffdaea 100644
(file)
--- 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() {
git clone https://git.99rst.org/PROJECT