From ed731fec7c4a5528a0e7afa03ce188d7e34192c7 Mon Sep 17 00:00:00 2001 From: Zhao Lei Date: Tue, 22 Sep 2015 10:45:20 +1000 Subject: [PATCH] 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 Reviewed-by: Dave Chinner Signed-off-by: Dave Chinner --- tests/generic/014 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/generic/014 b/tests/generic/014 index 79619619..a144a474 100755 --- a/tests/generic/014 +++ b/tests/generic/014 @@ -61,12 +61,13 @@ echo "brevity is wit..." echo "------" echo "test 1" echo "------" -if ! src/truncfile -c 10000 $TEST_DIR/truncfile.$$.0 >$tmp.out 2>&1 -then - out=`cat $tmp.out` - echo "truncfile returned $? : \"$out\"" +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 $ret : \"$out\"" else - echo "OK" + echo "OK" fi exit