[前][次][番号順一覧][スレッド一覧]

ruby-changes:38007

From: nobu <ko1@a...>
Date: Wed, 25 Mar 2015 17:03:40 +0900 (JST)
Subject: [ruby-changes:38007] nobu:r50088 (trunk): fs.c: fix f_type

nobu	2015-03-25 17:03:11 +0900 (Wed, 25 Mar 2015)

  New Revision: 50088

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50088

  Log:
    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]

  Modified files:
    trunk/ChangeLog
    trunk/ext/-test-/file/fs.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 50087)
+++ ChangeLog	(revision 50088)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Mar 25 17:03:08 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* ext/-test-/file/fs.c (get_fsname): try magic number only if
+	  f_type is included.  [ruby-dev:48913] [Bug #11000]
+
 Wed Mar 25 11:20:40 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* benchmark/bm_hash_aref_flo.rb: make more realistic data.
Index: ext/-test-/file/fs.c
===================================================================
--- ext/-test-/file/fs.c	(revision 50087)
+++ ext/-test-/file/fs.c	(revision 50088)
@@ -12,21 +12,24 @@ https://github.com/ruby/ruby/blob/trunk/ext/-test-/file/fs.c#L12
 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) https://github.com/ruby/ruby/blob/trunk/ext/-test-/file/fs.c#L48
     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) https://github.com/ruby/ruby/blob/trunk/ext/-test-/file/fs.c#L61
       case 0x01021994: /* TMPFS_MAGIC */
 	return CSTR("tmpfs");
     }
+# endif
 #endif
     return Qnil;
 }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]