diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2016-06-23 10:42:40 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-06-24 04:12:01 +0200 |
commit | 8f4faa1e3db91fc7b50d633e6f9b2f04bf978bb2 (patch) | |
tree | cc1b3cd4e5ef53ec4c3ac88dae3b4523a393174b | |
parent | 59f81976249a85cf02bd73c2395f018033069466 (diff) |
df: use f_frsize instead of f_bsize for correct sizes
Use the correct field f_frsize instead of f_bsize.
The statfs f_bsize is the "Optimal transfer block size" while the
f_frsize is the "Fragment size (since Linux 2.6)". On some FUSE
filesystems those may differ.
Fixes bug 9046
URL: https://bugs.busybox.net/show_bug.cgi?id=9046
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | coreutils/df.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/coreutils/df.c b/coreutils/df.c index d79c11a6c..06b292018 100644 --- a/coreutils/df.c +++ b/coreutils/df.c @@ -188,7 +188,7 @@ int df_main(int argc UNUSED_PARAM, char **argv) if (opt & OPT_INODE) { s.f_blocks = s.f_files; s.f_bavail = s.f_bfree = s.f_ffree; - s.f_bsize = 1; + s.f_frsize = 1; if (df_disp_hr) df_disp_hr = 1; @@ -246,26 +246,26 @@ int df_main(int argc UNUSED_PARAM, char **argv) #if ENABLE_FEATURE_HUMAN_READABLE printf(" %9s ", - /* f_blocks x f_bsize / df_disp_hr, show one fractional, + /* f_blocks x f_frsize / df_disp_hr, show one fractional, * use suffixes if df_disp_hr == 0 */ - make_human_readable_str(s.f_blocks, s.f_bsize, df_disp_hr)); + make_human_readable_str(s.f_blocks, s.f_frsize, df_disp_hr)); printf(" %9s " + 1, - /* EXPR x f_bsize / df_disp_hr, show one fractional, + /* EXPR x f_frsize / df_disp_hr, show one fractional, * use suffixes if df_disp_hr == 0 */ make_human_readable_str((s.f_blocks - s.f_bfree), - s.f_bsize, df_disp_hr)); + s.f_frsize, df_disp_hr)); printf("%9s %3u%% %s\n", - /* f_bavail x f_bsize / df_disp_hr, show one fractional, + /* f_bavail x f_frsize / df_disp_hr, show one fractional, * use suffixes if df_disp_hr == 0 */ - make_human_readable_str(s.f_bavail, s.f_bsize, df_disp_hr), + make_human_readable_str(s.f_bavail, s.f_frsize, df_disp_hr), blocks_percent_used, mount_point); #else printf(" %9lu %9lu %9lu %3u%% %s\n", - kscale(s.f_blocks, s.f_bsize), - kscale(s.f_blocks - s.f_bfree, s.f_bsize), - kscale(s.f_bavail, s.f_bsize), + kscale(s.f_blocks, s.f_frsize), + kscale(s.f_blocks - s.f_bfree, s.f_frsize), + kscale(s.f_bavail, s.f_frsize), blocks_percent_used, mount_point); #endif } |