mirror of
https://github.com/sheumann/hush.git
synced 2025-02-22 10:29:10 +00:00
df: fix FEATURE_DF_FANCY=off, FEATURE_HUMAN_READABLE=on case.
This commit is contained in:
parent
7f88e34e1a
commit
0354aba9a1
@ -44,8 +44,7 @@ int df_main(int argc, char **argv)
|
|||||||
FILE *mount_table;
|
FILE *mount_table;
|
||||||
struct mntent *mount_entry;
|
struct mntent *mount_entry;
|
||||||
struct statfs s;
|
struct statfs s;
|
||||||
static const char ignored_mounts[] ALIGN1 =
|
static const char ignored_mounts[] ALIGN1 = "rootfs\0";
|
||||||
"rootfs\0";
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
OPT_KILO = (1 << 0),
|
OPT_KILO = (1 << 0),
|
||||||
@ -53,8 +52,8 @@ int df_main(int argc, char **argv)
|
|||||||
OPT_ALL = (1 << 2) * ENABLE_FEATURE_DF_FANCY,
|
OPT_ALL = (1 << 2) * ENABLE_FEATURE_DF_FANCY,
|
||||||
OPT_INODE = (1 << 3) * ENABLE_FEATURE_DF_FANCY,
|
OPT_INODE = (1 << 3) * ENABLE_FEATURE_DF_FANCY,
|
||||||
OPT_BSIZE = (1 << 4) * ENABLE_FEATURE_DF_FANCY,
|
OPT_BSIZE = (1 << 4) * ENABLE_FEATURE_DF_FANCY,
|
||||||
OPT_HUMAN = (1 << 5) * ENABLE_FEATURE_HUMAN_READABLE,
|
OPT_HUMAN = (1 << (2 + 3*ENABLE_FEATURE_DF_FANCY)) * ENABLE_FEATURE_HUMAN_READABLE,
|
||||||
OPT_MEGA = (1 << 6) * ENABLE_FEATURE_HUMAN_READABLE,
|
OPT_MEGA = (1 << (3 + 3*ENABLE_FEATURE_DF_FANCY)) * ENABLE_FEATURE_HUMAN_READABLE,
|
||||||
};
|
};
|
||||||
const char *disp_units_hdr = NULL;
|
const char *disp_units_hdr = NULL;
|
||||||
char *chp;
|
char *chp;
|
||||||
@ -124,7 +123,7 @@ int df_main(int argc, char **argv)
|
|||||||
mount_entry = find_mount_point(mount_point, bb_path_mtab_file);
|
mount_entry = find_mount_point(mount_point, bb_path_mtab_file);
|
||||||
if (!mount_entry) {
|
if (!mount_entry) {
|
||||||
bb_error_msg("%s: can't find mount point", mount_point);
|
bb_error_msg("%s: can't find mount point", mount_point);
|
||||||
SET_ERROR:
|
set_error:
|
||||||
status = EXIT_FAILURE;
|
status = EXIT_FAILURE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -135,7 +134,7 @@ int df_main(int argc, char **argv)
|
|||||||
|
|
||||||
if (statfs(mount_point, &s) != 0) {
|
if (statfs(mount_point, &s) != 0) {
|
||||||
bb_simple_perror_msg(mount_point);
|
bb_simple_perror_msg(mount_point);
|
||||||
goto SET_ERROR;
|
goto set_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((s.f_blocks > 0) || !mount_table || (opt & OPT_ALL)) {
|
if ((s.f_blocks > 0) || !mount_table || (opt & OPT_ALL)) {
|
||||||
@ -166,7 +165,7 @@ int df_main(int argc, char **argv)
|
|||||||
* or leaves device alone if it can't find it */
|
* or leaves device alone if it can't find it */
|
||||||
device = find_block_device("/");
|
device = find_block_device("/");
|
||||||
if (!device) {
|
if (!device) {
|
||||||
goto SET_ERROR;
|
goto set_error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user