summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Clarke2017-10-07 18:53:20 +0100
committerDenys Vlasenko2017-10-30 15:30:59 +0100
commitd1535216ca27047e3962d61b975bd2a638aa45a2 (patch)
tree05a51eabd29d6db7c0885e798c05d43195f186ac
parent24e17b43858e165ba8384e2aa7403cecd899ad2d (diff)
downloadbusybox-d1535216ca27047e3962d61b975bd2a638aa45a2.zip
busybox-d1535216ca27047e3962d61b975bd2a638aa45a2.tar.gz
df: Use statvfs instead of non-standard statfs
Platforms differ on what their implementations of statfs include. Importantly, FreeBSD's does not include a f_frsize member inside struct statfs. However, statvfs is specified by POSIX and includes everything we need, so we can just use that instead. Signed-off-by: James Clarke <jrtc27@jrtc27.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--coreutils/df.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/coreutils/df.c b/coreutils/df.c
index 121da97..4076b5f 100644
--- a/coreutils/df.c
+++ b/coreutils/df.c
@@ -77,7 +77,7 @@
//usage: "/dev/sda3 17381728 17107080 274648 98% /\n"
#include <mntent.h>
-#include <sys/vfs.h>
+#include <sys/statvfs.h>
#include "libbb.h"
#include "unicode.h"
@@ -98,7 +98,7 @@ int df_main(int argc UNUSED_PARAM, char **argv)
unsigned opt;
FILE *mount_table;
struct mntent *mount_entry;
- struct statfs s;
+ struct statvfs s;
enum {
OPT_KILO = (1 << 0),
@@ -211,7 +211,7 @@ int df_main(int argc UNUSED_PARAM, char **argv)
mount_point = mount_entry->mnt_dir;
fs_type = mount_entry->mnt_type;
- if (statfs(mount_point, &s) != 0) {
+ if (statvfs(mount_point, &s) != 0) {
bb_simple_perror_msg(mount_point);
goto set_error;
}