summaryrefslogtreecommitdiff
path: root/ext/-test-
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-25 08:03:11 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-25 08:03:11 +0000
commit526b12964f5ff09e671a2faf69bc6ca69db8bb54 (patch)
tree252963cc12a0b6c063b1b772443c082dc5e4637a /ext/-test-
parent8d4321346722326acb2bb87e9cc7ea2a3af6c355 (diff)
fs.c: fix f_type
* ext/-test-/file/fs.c (get_fsname): try magic number only if f_type is included. [ruby-dev:48913] [Bug #11000] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50088 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/-test-')
-rw-r--r--ext/-test-/file/fs.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/ext/-test-/file/fs.c b/ext/-test-/file/fs.c
index 94d96d3305..1ab067e1b2 100644
--- a/ext/-test-/file/fs.c
+++ b/ext/-test-/file/fs.c
@@ -12,21 +12,24 @@
typedef struct statfs statfs_t;
# define STATFS(f, s) statfs((f), (s))
# define HAVE_STRUCT_STATFS_T_F_FSTYPENAME 1
+# if defined HAVE_STRUCT_STATFS_F_TYPE
+# define HAVE_STRUCT_STATFS_T_F_TYPE 1
+# endif
#elif defined(HAVE_STRUCT_STATVFS_F_FSTYPENAME) /* NetBSD */
typedef struct statvfs statfs_t;
# define STATFS(f, s) statvfs((f), (s))
# define HAVE_STRUCT_STATFS_T_F_FSTYPENAME 1
+# if defined HAVE_STRUCT_STATVFS_F_TYPE
+# define HAVE_STRUCT_STATFS_T_F_TYPE 1
+# endif
#elif defined(HAVE_STRUCT_STATVFS_F_BASETYPE) /* AIX, HP-UX, Solaris */
typedef struct statvfs statfs_t;
# define STATFS(f, s) statvfs((f), (s))
# define HAVE_STRUCT_STATFS_T_F_FSTYPENAME 1
# define f_fstypename f_basetype
-#elif defined HAVE_STRUCT_STATFS_F_TYPE
-typedef struct statfs statfs_t;
-# define STATFS(f, s) statfs((f), (s))
-#elif defined HAVE_STRUCT_STATVFS_F_TYPE
-typedef struct statvfs statfs_t;
-# define STATFS(f, s) statvfs((f), (s))
+# if defined HAVE_STRUCT_STATVFS_F_TYPE
+# define HAVE_STRUCT_STATFS_T_F_TYPE 1
+# endif
#endif
VALUE
@@ -45,6 +48,7 @@ get_fsname(VALUE self, VALUE str)
if (st.f_fstypename[0])
return CSTR(st.f_fstypename);
# endif
+# ifdef HAVE_STRUCT_STATFS_T_F_TYPE
switch (st.f_type) {
case 0x9123683E: /* BTRFS_SUPER_MAGIC */
return CSTR("btrfs");
@@ -57,6 +61,7 @@ get_fsname(VALUE self, VALUE str)
case 0x01021994: /* TMPFS_MAGIC */
return CSTR("tmpfs");
}
+# endif
#endif
return Qnil;
}