diff mbox

fstests: Fix wrong ret value in log

Message ID 2747ef92dbd3d3b64a7b7e397155af9b57630312.1442807209.git.zhaolei@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Zhaolei Sept. 21, 2015, 3:47 a.m. UTC
From: Zhao Lei <zhaolei@cn.fujitsu.com>

Current code always output "truncfile returned 0" because $? was
modified by previous command.

This patch fixed above bug.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
---
 tests/generic/014 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/tests/generic/014 b/tests/generic/014
index 7961961..a775f8b 100755
--- a/tests/generic/014
+++ b/tests/generic/014
@@ -61,10 +61,12 @@  echo "brevity is wit..."
 echo "------"
 echo "test 1"
 echo "------"
-if ! src/truncfile -c 10000 $TEST_DIR/truncfile.$$.0 >$tmp.out 2>&1
+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