From cee267d8c8175e6f8cd7605ccb11379a20ea8c99 Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Tue, 22 Oct 2013 10:10:21 -0400 Subject: Btrfs-progs: make pretty_sizes take u64 instead of a double This got changed to a double but all the callers still use a u64, which causes us to segfault sometimes because of some weird C voodoo that I had to have explained to me. Apparently because we're using a double the compiler will use the floating point registers to hold our argument which ends up not being aligned properly if you don't actually give it a double so it will cause problems for other things, in our case it was screwing up str_bytes so it was larger than the actual size of the str. This patch fixes the segfault. Thanks, Signed-off-by: Josef Bacik Signed-off-by: Chris Mason --- utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'utils.c') diff --git a/utils.c b/utils.c index d2410444..5bedd97f 100644 --- a/utils.c +++ b/utils.c @@ -1213,7 +1213,7 @@ out: } static char *size_strs[] = { "", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB"}; -int pretty_size_snprintf(double size, char *str, size_t str_bytes) +int pretty_size_snprintf(u64 size, char *str, size_t str_bytes) { int num_divs = 0; float fraction; -- cgit v1.2.3