aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-06-29 01:07:04 +0000
committerMike Frysinger <vapier@gentoo.org>2005-06-29 01:07:04 +0000
commit8804c6a3b79eb1b324ecd07d2992e6fcce0d7029 (patch)
tree3c8d6d572a4377cff3d73d221b97ad462212b8b4
parentfc379ba077d57e9c03339cbd21da2cad33592db4 (diff)
downloadbusybox-w32-8804c6a3b79eb1b324ecd07d2992e6fcce0d7029.tar.gz
busybox-w32-8804c6a3b79eb1b324ecd07d2992e6fcce0d7029.tar.bz2
busybox-w32-8804c6a3b79eb1b324ecd07d2992e6fcce0d7029.zip
dont use f_frsize unless linux-2.6.0 or better
-rw-r--r--coreutils/stat.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/coreutils/stat.c b/coreutils/stat.c
index 33f01deb0..b41e1d3be 100644
--- a/coreutils/stat.c
+++ b/coreutils/stat.c
@@ -32,9 +32,15 @@
32#include <time.h> 32#include <time.h>
33#include <getopt.h> 33#include <getopt.h>
34#include <sys/stat.h> 34#include <sys/stat.h>
35#include <sys/statfs.h>
36#include <sys/statvfs.h>
35#include <string.h> 37#include <string.h>
36#include "busybox.h" 38#include "busybox.h"
37 39
40#ifdef __linux__
41# include <linux/version.h>
42#endif
43
38/* vars to control behavior */ 44/* vars to control behavior */
39#define OPT_TERSE 2 45#define OPT_TERSE 2
40#define OPT_DEREFERNCE 4 46#define OPT_DEREFERNCE 4
@@ -172,9 +178,14 @@ static void print_statfs(char *pformat, size_t buf_len, char m,
172 printf(pformat, (unsigned long int) (statfsbuf->f_bsize)); 178 printf(pformat, (unsigned long int) (statfsbuf->f_bsize));
173 break; 179 break;
174 case 'S': { 180 case 'S': {
175 unsigned long int frsize = statfsbuf->f_frsize; 181 unsigned long int frsize;
182#if defined(__linux__) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
183 frsize = statfsbuf->f_frsize;
176 if (!frsize) 184 if (!frsize)
177 frsize = statfsbuf->f_bsize; 185 frsize = statfsbuf->f_bsize;
186#else
187 frsize = statfsbuf->f_bsize;
188#endif
178 strncat(pformat, "lu", buf_len); 189 strncat(pformat, "lu", buf_len);
179 printf(pformat, frsize); 190 printf(pformat, frsize);
180 break; 191 break;