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:
parent
78802f2850
commit
f561dda7a2
@ -40,7 +40,8 @@ case "$1" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
call)
|
call)
|
||||||
case "$2" in
|
handle_call() {
|
||||||
|
case "$1" in
|
||||||
get_devices)
|
get_devices)
|
||||||
. "${DI_LIB}/functions.sh"
|
. "${DI_LIB}/functions.sh"
|
||||||
local devices=$(di_get_devices)
|
local devices=$(di_get_devices)
|
||||||
@ -239,10 +240,12 @@ case "$1" in
|
|||||||
*)
|
*)
|
||||||
json_init
|
json_init
|
||||||
json_add_boolean "error" 1
|
json_add_boolean "error" 1
|
||||||
json_add_string "message" "Unknown method: $2"
|
json_add_string "message" "Unknown method: $1"
|
||||||
json_dump
|
json_dump
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
}
|
||||||
|
handle_call "$2"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,8 @@ case "$1" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
call)
|
call)
|
||||||
case "$2" in
|
handle_call() {
|
||||||
|
case "$1" in
|
||||||
get_config)
|
get_config)
|
||||||
json_init
|
json_init
|
||||||
|
|
||||||
@ -241,10 +242,12 @@ case "$1" in
|
|||||||
*)
|
*)
|
||||||
json_init
|
json_init
|
||||||
json_add_boolean "error" 1
|
json_add_boolean "error" 1
|
||||||
json_add_string "message" "Unknown method: $2"
|
json_add_string "message" "Unknown method: $1"
|
||||||
json_dump
|
json_dump
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
}
|
||||||
|
handle_call "$2"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user