generic/014: Fix wrong return value in output

Current code always output "truncfile returned 0" because $? was
modified by previous command. Use $ret to indicate the correct
return value from truncfile.

[dchinner: fix formatting issues, update commit message.]

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
Zhao Lei
2015-09-22 10:45:20 +10:00
committed by Dave Chinner
parent 3038de2b24
commit ed731fec7c
+4 -3
View File
@@ -61,10 +61,11 @@ echo "brevity is wit..."
echo "------"
echo "test 1"
echo "------"
if ! src/truncfile -c 10000 $TEST_DIR/truncfile.$$.0 >$tmp.out 2>&1
then
src/truncfile -c 10000 $TEST_DIR/truncfile.$$.0 >$tmp.out 2>&1
ret=$?
if [ "$ret" -ne 0 ]; then
out=`cat $tmp.out`
echo "truncfile returned $? : \"$out\""
echo "truncfile returned $ret : \"$out\""
else
echo "OK"
fi