]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdadm/test: use the first element of array as parsing condition
authorZhilong Liu <zlliu@suse.com>
Mon, 28 Aug 2017 09:24:28 +0000 (17:24 +0800)
committerJes Sorensen <jsorensen@fb.com>
Fri, 1 Sep 2017 15:22:03 +0000 (11:22 -0400)
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>
test

diff --git a/test b/test
index 87e2df2d0164999a6dbf1779eaccf94daddf05a5..25268a0f76b38a6554df244f13e5ac665ae96362 100755 (executable)
--- a/test
+++ b/test
@@ -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"