diff options
author | Karel Zak | 2019-05-13 17:07:14 +0200 |
---|---|---|
committer | Karel Zak | 2019-05-13 17:07:14 +0200 |
commit | 8c368dc6d3771d4655c953c42ff009f20d51de1f (patch) | |
tree | ff4c8bf0697c12ac198e1c61d7b7674d4da1bb75 /libblkid | |
parent | lib/strutils: parse_size() fix frac with zeros (diff) | |
download | kernel-qcow2-util-linux-8c368dc6d3771d4655c953c42ff009f20d51de1f.tar.gz kernel-qcow2-util-linux-8c368dc6d3771d4655c953c42ff009f20d51de1f.tar.xz kernel-qcow2-util-linux-8c368dc6d3771d4655c953c42ff009f20d51de1f.zip |
lib/strutils: parse_size() fix frac digit calculation
Old code:
./test_strutils --size 0.5MiB
0.5MiB : 512000 : 500K : 500 KiB
./test_strutils --size 0.50MiB
0.50MiB : 5120000 : 4.9M : 4.9 MiB
New code:
./test_strutils --size 0.5MiB
0.5MiB : 524288 : 512K : 512 KiB
./test_strutils --size 0.50MiB
0.50MiB : 524288 : 512K : 512 KiB
Note that the new implementation also does not use float points,
because we need to support PiB and so on... it seems good enough for
things like:
./test_strutils --size 7.13G
7.13G : 7656104581 : 7.1G : 7.1 GiB
./test_strutils --size 7.16G
7.16G : 7690675814 : 7.2G : 7.2 GiB
to avoid situation where cfdisk creates partition with completely
crazy numbers.
Addresses: https://github.com/karelzak/util-linux/issues/782
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libblkid')
0 files changed, 0 insertions, 0 deletions