diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2017-04-10 13:50:41 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-04-11 18:05:09 +0100 |
commit | fc6370626e31951d112337c7a5f9ae15a4b73965 (patch) | |
tree | 363533e8bdc8fe11787baa63fd28bb10cd303b08 /bitbake | |
parent | 2a40a0587e64a4bdf2ed64c4b84f0d6f4d602d7c (diff) | |
download | poky-fc6370626e31951d112337c7a5f9ae15a4b73965.tar.gz |
bitbake: cache: prevent division-by-zero in load_cahefile()
[YOCTO 11315]
(Bitbake rev: 227c5acd4b40154bc61202e7bb67a13818a7d727)
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/cache.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py index 28e8a87455..e7eeb4f505 100644 --- a/bitbake/lib/bb/cache.py +++ b/bitbake/lib/bb/cache.py | |||
@@ -462,6 +462,10 @@ class Cache(NoCache): | |||
462 | self.depends_cache[key] = [value] | 462 | self.depends_cache[key] = [value] |
463 | # only fire events on even percentage boundaries | 463 | # only fire events on even percentage boundaries |
464 | current_progress = cachefile.tell() + previous_progress | 464 | current_progress = cachefile.tell() + previous_progress |
465 | if current_progress > cachesize: | ||
466 | # we might have calculated incorrect total size because a file | ||
467 | # might've been written out just after we checked its size | ||
468 | cachesize = current_progress | ||
465 | current_percent = 100 * current_progress / cachesize | 469 | current_percent = 100 * current_progress / cachesize |
466 | if current_percent > previous_percent: | 470 | if current_percent > previous_percent: |
467 | previous_percent = current_percent | 471 | previous_percent = current_percent |