mdadm/test: use the first element of array as parsing condition

it would complain "too many arguments" when array[] has
few members, it's proper to check whether or not array[0]
is null.

Reported-by: Xiao Ni <xni@redhat.com>
Signed-off-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
This commit is contained in:
Zhilong Liu 2017-08-28 17:24:28 +08:00 committed by Jes Sorensen
parent 8cc56e8b32
commit 3af7f2adc0
1 changed files with 1 additions and 1 deletions

2
test
View File

@ -75,7 +75,7 @@ save_log() {
echo
elif [ "$DEVTYPE" == 'loop' -o "$DEVTYPE" == 'disk' ]
then
if [ ! -z ${array[@]} -a ${#array[@]} -ge 1 ]
if [ ! -z "$array" -a ${#array[@]} -ge 1 ]
then
md_disks=($($mdadm -D -Y ${array[@]} | grep "/dev/" | cut -d'=' -f2))
cat /proc/mdstat | grep -q "bitmap"