projects
/
platform
/
upstream
/
mic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8fe3f7f
)
check if size is 0 in human_size, avoid math domain error
author
Gui Chen
<gui.chen@intel.com>
Thu, 22 Mar 2012 08:59:34 +0000
(16:59 +0800)
committer
Gui Chen
<gui.chen@intel.com>
Thu, 22 Mar 2012 08:59:34 +0000
(16:59 +0800)
Signed-off-by: Gui Chen <gui.chen@intel.com>
mic/utils/misc.py
patch
|
blob
|
history
diff --git
a/mic/utils/misc.py
b/mic/utils/misc.py
index
636fffc
..
05d8a9a
100644
(file)
--- a/
mic/utils/misc.py
+++ b/
mic/utils/misc.py
@@
-57,6
+57,8
@@
def human_size(size):
"""Return human readable string for Bytes size
"""
+ if size <= 0:
+ return "0M"
import math
measure = ['B', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']
expo = int(math.log(size, 1024))