test the correct return value

`res=$?` erases `$?` (sets it to 0)

fixes #5577

License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
This commit is contained in:
Steven Allen 2018-10-10 10:08:54 +01:00
parent d0d300c4ae
commit 67ea8dde0e

View File

@ -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