From 67ea8dde0e715fc9aabcb514cab076dd6c656cf7 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 10 Oct 2018 10:08:54 +0100 Subject: [PATCH] test the correct return value `res=$?` erases `$?` (sets it to 0) fixes #5577 License: MIT Signed-off-by: Steven Allen --- test/sharness/lib/test-lib.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/sharness/lib/test-lib.sh b/test/sharness/lib/test-lib.sh index 05cfc57d1fa..92df63c4e69 100644 --- a/test/sharness/lib/test-lib.sh +++ b/test/sharness/lib/test-lib.sh @@ -405,13 +405,13 @@ directory_size() { find "$1" -type f | ( while read fname; do fsize=$(file_size "$fname") res=$? - if ! test $? -eq 0; then + if ! test $res -eq 0; then echo "failed to get filesize" >&2 return $res fi total=$(expr "$total" + "$fsize") res=$? - if ! test $? -eq 0; then + if ! test $res -eq 0; then echo "filesize not a number: $fsize" >&2 return $res fi