summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorMike Frysinger2005-06-29 01:07:04 +0000
committerMike Frysinger2005-06-29 01:07:04 +0000
commit8804c6a3b79eb1b324ecd07d2992e6fcce0d7029 (patch)
tree3c8d6d572a4377cff3d73d221b97ad462212b8b4 /coreutils
parentfc379ba077d57e9c03339cbd21da2cad33592db4 (diff)
downloadbusybox-8804c6a3b79eb1b324ecd07d2992e6fcce0d7029.zip
busybox-8804c6a3b79eb1b324ecd07d2992e6fcce0d7029.tar.gz
dont use f_frsize unless linux-2.6.0 or better
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/stat.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/coreutils/stat.c b/coreutils/stat.c
index 33f01de..b41e1d3 100644
--- a/coreutils/stat.c
+++ b/coreutils/stat.c
@@ -32,9 +32,15 @@
#include <time.h>
#include <getopt.h>
#include <sys/stat.h>
+#include <sys/statfs.h>
+#include <sys/statvfs.h>
#include <string.h>
#include "busybox.h"
+#ifdef __linux__
+# include <linux/version.h>
+#endif
+
/* vars to control behavior */
#define OPT_TERSE 2
#define OPT_DEREFERNCE 4
@@ -172,9 +178,14 @@ static void print_statfs(char *pformat, size_t buf_len, char m,
printf(pformat, (unsigned long int) (statfsbuf->f_bsize));
break;
case 'S': {
- unsigned long int frsize = statfsbuf->f_frsize;
+ unsigned long int frsize;
+#if defined(__linux__) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+ frsize = statfsbuf->f_frsize;
if (!frsize)
frsize = statfsbuf->f_bsize;
+#else
+ frsize = statfsbuf->f_bsize;
+#endif
strncat(pformat, "lu", buf_len);
printf(pformat, frsize);
break;