fix(rpcd): Wrap call handlers in function for BusyBox ash local keyword compatibility

BusyBox ash rejects `local` outside a function. Both RPCD handlers used
`local` directly in the case block, causing "not in a function" errors
and silent RPC failures (empty responses).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
CyberMind-FR 2026-02-04 16:39:50 +01:00
parent 78802f2850
commit f561dda7a2
2 changed files with 10 additions and 4 deletions

View File

@ -40,7 +40,8 @@ case "$1" in
;;
call)
case "$2" in
handle_call() {
case "$1" in
get_devices)
. "${DI_LIB}/functions.sh"
local devices=$(di_get_devices)
@ -239,10 +240,12 @@ case "$1" in
*)
json_init
json_add_boolean "error" 1
json_add_string "message" "Unknown method: $2"
json_add_string "message" "Unknown method: $1"
json_dump
;;
esac
}
handle_call "$2"
;;
esac

View File

@ -39,7 +39,8 @@ case "$1" in
;;
call)
case "$2" in
handle_call() {
case "$1" in
get_config)
json_init
@ -241,10 +242,12 @@ case "$1" in
*)
json_init
json_add_boolean "error" 1
json_add_string "message" "Unknown method: $2"
json_add_string "message" "Unknown method: $1"
json_dump
;;
esac
}
handle_call "$2"
;;
esac