summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Kampka <christian@kampka.net>2015-10-17 15:49:27 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2015-10-28 14:26:59 +0000
commitb67dec210ad22b1ff9156ead892593c8a2f23925 (patch)
tree9ff40647d2c2c160d7e37c2a694ec619f81c49c2
parent62853e714521d98dead841ba954f2b9778f2ff37 (diff)
downloadabuild-b67dec210ad22b1ff9156ead892593c8a2f23925.tar.gz
abuild-b67dec210ad22b1ff9156ead892593c8a2f23925.tar.bz2
abuild-b67dec210ad22b1ff9156ead892593c8a2f23925.tar.xz
abuild-b67dec210ad22b1ff9156ead892593c8a2f23925.zip
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.
-rw-r--r--abuild.in3
1 files changed, 1 insertions, 2 deletions
diff --git a/abuild.in b/abuild.in
index 3b6fe04..0dd8f9a 100644
--- a/abuild.in
+++ b/abuild.in
@@ -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
-