spiegel_podman/cmd/podman/system
Paul Holzinger e3cc0717b2
podman system df: fix percent calculation
The calculate the percentage we need floating point numbers. The current
code however casted the result of reclaimable/size to an int first.
Casting to an int in go will just discard the decimal points, thus the
result was either 0 or 1 so if multiplied by 100 it would show up as 0%
or 100%.

To fix this we have to multiply by 100 first before casting the result
to an int. Also add a check for div by zero which results in NaN and use
math.Round() to correctly round a number.

Ref #13516

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-03-21 13:19:31 +01:00
..
connection bump go module to version 4 2022-01-18 12:47:07 +01:00
connection.go bump go module to version 4 2022-01-18 12:47:07 +01:00
df.go podman system df: fix percent calculation 2022-03-21 13:19:31 +01:00
dial_stdio.go bump go module to version 4 2022-01-18 12:47:07 +01:00
events.go bump go module to version 4 2022-01-18 12:47:07 +01:00
info.go bump go module to version 4 2022-01-18 12:47:07 +01:00
migrate.go go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
prune.go bump go module to version 4 2022-01-18 12:47:07 +01:00
renumber.go go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
reset.go go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
service.go go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
service_abi.go go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
system.go bump go module to version 4 2022-01-18 12:47:07 +01:00
unshare.go bump go module to version 4 2022-01-18 12:47:07 +01:00
version.go fix empty newline in version output 2022-03-15 20:44:19 +01:00