dist: scylla_lib.sh: get_mode_cpu_set: split the declaration and ssignment to the local variable

In bash local variable declaration is a separate operation with its own exit status
(always 0) therefore constructs like

local var=`cmd`

will always result in the 0 exit status ($? value) regardless of the actual
result of "cmd" invocation.

To overcome this we should split the declaration and the assignment to be like this:

local var
var=`cmd`

Fixes #3508

Signed-off-by: Vlad Zolotarov <vladz@scylladb.com>
Message-Id: <1529702903-24909-3-git-send-email-vladz@scylladb.com>
This commit is contained in:
Vlad Zolotarov
2018-06-22 17:28:23 -04:00
committed by Avi Kivity
parent f3ca17b1a1
commit 7495c8e56d

View File

@@ -51,7 +51,8 @@ verify_args() {
#
get_mode_cpu_set() {
local mode=$1
local mode_cpu_mask=`/usr/lib/scylla/perftune.py --tune net --nic "$nic" --mode "$mode" --get-cpu-mask 2>&-`
local mode_cpu_mask
mode_cpu_mask=`/usr/lib/scylla/perftune.py --tune net --nic "$nic" --mode "$mode" --get-cpu-mask 2>&-`
# If the given mode is not supported - return invalid CPU set
if [[ "$?" -ne "0" ]]; then