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 8249c5c01cfd26378bff75bd73463e1b7b08ebfb..9ef1e786a0a5c2abd40da2a4d5d00c1d54fb30f2 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 493d303e62cf4fa6c490802fe6f95f8a82a00783..a11698fa2d8c70ece48020abb71d7d97406c33eb 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