shellcheck: Fix SC2155
SC2155 (warning): Declare and assign separately to avoid masking
return values.
No bug identified.
Reviewed-by: Andrew Jones <andrew.jones@linux.dev>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Andrew Jones <andrew.jones@linux.dev>
diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
index 2ac7b0b..45ec8f5 100644
--- a/scripts/arch-run.bash
+++ b/scripts/arch-run.bash
@@ -415,7 +415,8 @@
{
rm -f $KVM_UNIT_TESTS_ENV
if [ "$KVM_UNIT_TESTS_ENV_OLD" ]; then
- export KVM_UNIT_TESTS_ENV="$KVM_UNIT_TESTS_ENV_OLD"
+ export KVM_UNIT_TESTS_ENV
+ KVM_UNIT_TESTS_ENV="$KVM_UNIT_TESTS_ENV_OLD"
else
unset KVM_UNIT_TESTS_ENV
fi
@@ -427,7 +428,8 @@
if [ "$ENVIRON_DEFAULT" = "yes" ]; then
trap_exit_push 'initrd_cleanup'
[ -f "$KVM_UNIT_TESTS_ENV" ] && export KVM_UNIT_TESTS_ENV_OLD="$KVM_UNIT_TESTS_ENV"
- export KVM_UNIT_TESTS_ENV=$(mktemp)
+ export KVM_UNIT_TESTS_ENV
+ KVM_UNIT_TESTS_ENV=$(mktemp)
env_params
env_file
env_errata || return $?
@@ -570,7 +572,9 @@
trap_exit_push ()
{
- local old_exit=$(trap -p EXIT | sed "s/^[^']*'//;s/'[^']*$//")
+ local old_exit
+
+ old_exit=$(trap -p EXIT | sed "s/^[^']*'//;s/'[^']*$//")
trap -- "$1; $old_exit" EXIT
}
diff --git a/scripts/runtime.bash b/scripts/runtime.bash
index e7af9bd..597c909 100644
--- a/scripts/runtime.bash
+++ b/scripts/runtime.bash
@@ -15,7 +15,9 @@
# We assume that QEMU is going to work if it tried to load the kernel
premature_failure()
{
- local log="$(eval "$(get_cmdline _NO_FILE_4Uhere_)" 2>&1)"
+ local log
+
+ log="$(eval "$(get_cmdline _NO_FILE_4Uhere_)" 2>&1)"
echo "$log" | grep "_NO_FILE_4Uhere_" |
grep -q -e "could not \(load\|open\) kernel" -e "error loading" -e "failed to load" &&