mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2026-02-21 20:02:37 +01:00
Fix crash with operate without input
This commit is contained in:
parent
927e839c47
commit
d5d84ae1da
2 changed files with 16 additions and 5 deletions
|
|
@ -642,10 +642,10 @@ static int bbfdm_operate_handler(struct ubus_context *ctx, struct ubus_object *o
|
|||
data.bbf_ctx.in_param = path;
|
||||
data.bbf_ctx.linker = tb[DM_OPERATE_COMMAND_KEY] ? blobmsg_get_string(tb[DM_OPERATE_COMMAND_KEY]) : "";
|
||||
|
||||
str = blobmsg_format_json(tb[DM_OPERATE_INPUT], true);
|
||||
|
||||
if (tb[DM_OPERATE_INPUT])
|
||||
if (tb[DM_OPERATE_INPUT]) {
|
||||
str = blobmsg_format_json(tb[DM_OPERATE_INPUT], true);
|
||||
data.bbf_ctx.in_value = str;
|
||||
}
|
||||
|
||||
fill_optional_data(&data, tb[DM_OPERATE_OPTIONAL]);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,17 @@
|
|||
BBFDM_DMMAP_CONFIG="/etc/bbfdm/dmmap"
|
||||
BBFDM_DMMAP_SAVEDIR="/tmp/.bbfdm"
|
||||
|
||||
LOGLEVEL="$(uci -q get bbfdm.bbfdmd.loglevel)"
|
||||
|
||||
log() {
|
||||
local level
|
||||
|
||||
level="${LOGLEVEL:-0}"
|
||||
if [ "${level}" -gt 2 ]; then
|
||||
echo "$@" | logger -t bbf.config -p info
|
||||
fi
|
||||
}
|
||||
|
||||
check_result() {
|
||||
local res="$1"
|
||||
local service="$2"
|
||||
|
|
@ -25,7 +36,7 @@ apply_config_changes() {
|
|||
return
|
||||
fi
|
||||
|
||||
logger -t bbf.config -p info "Applying $action configuration for service: $service"
|
||||
log "Applying $action configuration for service: $service"
|
||||
|
||||
# Commit/Revert config changes
|
||||
ubus -t 1 call uci ${action} "{'config': '${service}'}"
|
||||
|
|
@ -62,7 +73,7 @@ case "$1" in
|
|||
# Commit/Revert bbfdm dmmap config changes
|
||||
for file in "${BBFDM_DMMAP_CONFIG}"/*; do
|
||||
file_name=$(basename "${file}")
|
||||
logger -t bbf.config -p info "Applying $2 configuration for file: $file_name"
|
||||
log "Applying $2 configuration for file: $file_name"
|
||||
uci -q -c "${BBFDM_DMMAP_CONFIG}" -t "${BBFDM_DMMAP_SAVEDIR}" "$2" "${file_name}"
|
||||
check_result "$?" "${file_name}" "$2"
|
||||
done
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue