From 9dfa19ff1067457b47eb301099fd84a11425ff5e Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 10 Sep 2019 16:50:35 +0200 Subject: [run-virt] Fix: Explicitly initialize empty arrays --- .../opt/openslx/vmchooser/run-virt-includes/start_windowmanager.inc | 2 +- .../vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/start_windowmanager.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/start_windowmanager.inc index 85b4a96a..c080be8c 100644 --- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/start_windowmanager.inc +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/start_windowmanager.inc @@ -23,7 +23,7 @@ start_wm() { # start RUNVIRT_DM determined above writelog "Starting ${RUNVIRT_DM}." - declare -a OPTS= + declare -a OPTS=() case "$RUNVIRT_DM" in openbox|kwin|xfwm4|metacity) OPTS+=( "--replace" ) diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc index e6337236..937905ab 100644 --- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc @@ -91,7 +91,7 @@ $BODY" # Only accepts functions that were not previously registered. # This kinda detects when a cleanup function was overriden, # or at least that something is fishy. -declare -ag CLEANUP_TASKS +declare -ag CLEANUP_TASKS=() add_cleanup() { [ $# -lt 1 ] && writelog "'${FUNCNAME[0]}' needs at least one argument! $# given." && return # check if the given function name is already used @@ -128,7 +128,7 @@ cleanexit() { usleep 250000 local TASK if [ "${#CLEANUP_TASKS[@]}" -gt 0 ]; then - declare -a cleanups= + declare -a cleanups=() declare -a copy=( "${CLEANUP_TASKS[@]}" ) unset CLEANUP_TASKS for TASK in "${copy[@]}"; do @@ -235,7 +235,7 @@ translate() { # returns 100 if no hooks exist run_hooks() { local dir file retval r - declare -a files + declare -a files=() dir="$VMCHOOSER_DIR/hooks/${1}.d" [ -d "$dir" ] || return 100 shift -- cgit v1.2.3-55-g7522