diff options
author | Ron Yorston <rmy@pobox.com> | 2021-03-24 11:55:30 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2021-03-24 12:43:15 +0000 |
commit | 355a7a6c1e9626b7afe8758a6095f3cf275c52e1 (patch) | |
tree | 6dab679c15b049cab97212e0b43077132eec1fbe /coreutils/df.c | |
parent | 71ecc8033e6989996057b32577e71148fd544596 (diff) | |
parent | 889425812b5cda8b3394d73253cbde7355fb1115 (diff) | |
download | busybox-w32-w32_1_26_2.tar.gz busybox-w32-w32_1_26_2.tar.bz2 busybox-w32-w32_1_26_2.zip |
Merge tag '1_26_2' into w32_1_26_2w32_1_26_2
Diffstat (limited to '')
-rw-r--r-- | coreutils/df.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/coreutils/df.c b/coreutils/df.c index fdcdae675..79e4c4670 100644 --- a/coreutils/df.c +++ b/coreutils/df.c | |||
@@ -129,8 +129,19 @@ int df_main(int argc UNUSED_PARAM, char **argv) | |||
129 | if (opt & OPT_MEGA) | 129 | if (opt & OPT_MEGA) |
130 | df_disp_hr = 1024*1024; | 130 | df_disp_hr = 1024*1024; |
131 | 131 | ||
132 | if (opt & OPT_BSIZE) | 132 | if (opt & OPT_BSIZE) { |
133 | df_disp_hr = xatoul_range(chp, 1, ULONG_MAX); /* disallow 0 */ | 133 | /* GNU coreutils 8.25 accepts "-BMiB" form too */ |
134 | int i; | ||
135 | for (i = 0; kmg_i_suffixes[i].suffix[0]; i++) { | ||
136 | if (strcmp(kmg_i_suffixes[i].suffix, chp) == 0) { | ||
137 | df_disp_hr = kmg_i_suffixes[i].mult; | ||
138 | goto got_it; | ||
139 | } | ||
140 | } | ||
141 | /* Range used to disallow 0 */ | ||
142 | df_disp_hr = xatoul_range_sfx(chp, 1, ULONG_MAX, kmg_i_suffixes); | ||
143 | got_it: ; | ||
144 | } | ||
134 | 145 | ||
135 | /* From the manpage of df from coreutils-6.10: | 146 | /* From the manpage of df from coreutils-6.10: |
136 | * Disk space is shown in 1K blocks by default, unless the environment | 147 | * Disk space is shown in 1K blocks by default, unless the environment |
@@ -203,6 +214,11 @@ int df_main(int argc UNUSED_PARAM, char **argv) | |||
203 | bb_simple_perror_msg(mount_point); | 214 | bb_simple_perror_msg(mount_point); |
204 | goto set_error; | 215 | goto set_error; |
205 | } | 216 | } |
217 | /* Some uclibc versions were seen to lose f_frsize | ||
218 | * (kernel does return it, but then uclibc does not copy it) | ||
219 | */ | ||
220 | if (s.f_frsize == 0) | ||
221 | s.f_frsize = s.f_bsize; | ||
206 | 222 | ||
207 | if ((s.f_blocks > 0) || !mount_table || (opt & OPT_ALL)) { | 223 | if ((s.f_blocks > 0) || !mount_table || (opt & OPT_ALL)) { |
208 | if (opt & OPT_INODE) { | 224 | if (opt & OPT_INODE) { |