test the correct return value
`res=$?` erases `$?` (sets it to 0) fixes #5577 License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
Steven Allen committed
Oct 10, 2018 at 10:08 UTC
67ea8dde0e715fc9aabcb514cab076dd6c656cf7
1 file changed
+2
-2
test/sharness/lib/test-lib.sh
+2
-2
@@ -405,13 +405,13 @@ directory_size() {
405
find "$1" -type f | ( while read fname; do
406
fsize=$(file_size "$fname")
407
res=$?
408
- if ! test $? -eq 0; then
408
+ if ! test $res -eq 0; then
409
echo "failed to get filesize" >&2
410
return $res
411
fi
412
total=$(expr "$total" + "$fsize")
413
res=$?
414
- if ! test $? -eq 0; then
414
+ if ! test $res -eq 0; then
415
echo "filesize not a number: $fsize" >&2
416
return $res
417
fi