From f2a1d9f32ff9f126d2c64f0f5a924979b3bffefb Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Fri, 12 Jun 2020 19:18:22 +0200 Subject: [PATCH] fix v0.96 jssh_updateKey --- modules/jsonDB.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/modules/jsonDB.sh b/modules/jsonDB.sh index 88a6a8d..924a58b 100644 --- a/modules/jsonDB.sh +++ b/modules/jsonDB.sh @@ -5,7 +5,7 @@ # This file is public domain in the USA and all free countries. # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # -#### $$VERSION$$ v0.96-0-g3871ca9 +#### $$VERSION$$ v0.96-1-g15e6c7b # # source from commands.sh to use jsonDB functions # @@ -60,7 +60,6 @@ if _exists flock; then local DB; DB="$(jssh_checkDB "$2")" [ -z "${DB}" ] && return 1 [ ! -f "${DB}" ] && return 2 - declare -n ARRAY="$1" [ -z "${ARRAY[*]}" ] && return 1 declare -A oldARR @@ -164,9 +163,10 @@ if _exists flock; then #no own locking, so async is the same as updatekeyDB jssh_updateKeyDB() { [[ "$1" =~ ^[-a-zA-Z0-9,._]+$ ]] || return 3 - declare -A oldARR - oldARR["$1"]="$2" - jssh_updateDB "oldARR" "${3}" || return 3 + declare -A updARR + # shellcheck disable=SC2034 + updARR["$1"]="$2" + jssh_updateDB "updARR" "${3}" || return 3 } # $1 filename (must exist!), must be relative to BASHBOT_ETC, and not contain '..' @@ -311,9 +311,10 @@ jssh_countKeyDB_async() { #no own locking, so async is the same as updatekeyDB jssh_updateKeyDB_async() { [[ "$1" =~ ^[-a-zA-Z0-9,._]+$ ]] || return 3 - declare -A oldARR - oldARR["$1"]="$2" - jssh_updateDB_async "oldARR" "${3}" || return 3 + declare -A updARR + # shellcheck disable=SC2034 + updARR["$1"]="$2" + jssh_updateDB_async "updARR" "${3}" || return 3 } jssh_clearDB_async() {