From 7c81123da7031fc90dbbd9fc3f31b028beb5109c Mon Sep 17 00:00:00 2001 From: Xu Han Date: Thu, 14 Dec 2017 14:06:26 +0800 Subject: [PATCH] utils.crypto: Fix dead loop in hash_file function Fix the dead loop caused by a wrong indentation in the hash_file function. Signed-off-by: Xu Han --- avocado/utils/crypto.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/avocado/utils/crypto.py b/avocado/utils/crypto.py index ce64bd11..93f3ab8e 100644 --- a/avocado/utils/crypto.py +++ b/avocado/utils/crypto.py @@ -66,11 +66,11 @@ def hash_file(filename, size=None, algorithm="md5"): while size > 0: if chunksize > size: chunksize = size - data = file_to_hash.read(chunksize) - if len(data) == 0: - logging.debug("Nothing left to read but size=%d", size) - break - hash_obj.update(data) - size -= len(data) + data = file_to_hash.read(chunksize) + if len(data) == 0: + logging.debug("Nothing left to read but size=%d", size) + break + hash_obj.update(data) + size -= len(data) return hash_obj.hexdigest() -- GitLab