xfs: fix check of whether the mkfs fail
authorSun Ke <sunke32@huawei.com>
Fri, 28 May 2021 09:40:46 +0000 (05:40 -0400)
committerEryu Guan <guaneryu@gmail.com>
Sun, 30 May 2021 11:47:02 +0000 (19:47 +0800)
The return value ("$?") is always the status of the last command in
the pipe.

Signed-off-by: Sun Ke <sunke32@huawei.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/xfs/070
tests/xfs/448

index 8249c5c..9ef1e78 100755 (executable)
@@ -84,7 +84,8 @@ _supported_fs xfs
 _require_scratch_nocheck
 _require_command "$KILLALL_PROG" killall
 
-_scratch_mkfs | _filter_mkfs > /dev/null 2> $tmp.mkfs || _fail "mkfs failed"
+_scratch_mkfs | _filter_mkfs > /dev/null 2> $tmp.mkfs
+test "${PIPESTATUS[0]}" -eq 0 || _fail "mkfs failed"
 
 . $tmp.mkfs # import agcount
 
index 493d303..a11698f 100755 (executable)
@@ -47,7 +47,8 @@ _require_no_xfs_bug_on_assert
 rm -f "$seqres.full"
 
 # Format and mount
-_scratch_mkfs | _filter_mkfs > $seqres.full 2> $tmp.mkfs || _fail "mkfs failed"
+_scratch_mkfs | _filter_mkfs > $seqres.full 2> $tmp.mkfs
+test "${PIPESTATUS[0]}" -eq 0 || _fail "mkfs failed"
 _scratch_mount
 
 # Get directory block size