abuild: avoid division by zero when input is zero for calculating human size for packages

This occurs when building meta packages that do not have any package content.
This commit is contained in:
Christian Kampka 2015-10-17 15:49:27 +02:00 committed by Natanael Copa
parent 62853e7145
commit b67dec210a
1 changed files with 1 additions and 2 deletions

View File

@ -1253,7 +1253,7 @@ scan_pkgconfig_depends() {
# read size in bytes from stdin and show as human readable
human_size() {
awk '{ split("B KB MB GB TB PB", type)
for(i=5; y < 1; i--)
for(i=5; y < 1 && $1 > 0; i--)
y = $1 / (2**(10*i))
printf("%.1f %s\n", y, type[i+2]) }'
}
@ -2209,4 +2209,3 @@ for i in $install_after; do
done
cleanup