Should use `_fstat32()` on 32bit Windows.

parent 5210482c
...@@ -70,6 +70,10 @@ ...@@ -70,6 +70,10 @@
typedef struct stat mrb_stat; typedef struct stat mrb_stat;
# define mrb_stat(path, sb) stat(path, sb) # define mrb_stat(path, sb) stat(path, sb)
# define mrb_fstat(fd, sb) fstat(fd, sb) # define mrb_fstat(fd, sb) fstat(fd, sb)
#elif defined MRB_INT32
typedef struct __stat32 mrb_stat;
# define mrb_stat(path, sb) _stat32(path, sb)
# define mrb_fstat(fd, sb) _fstat32(fd, sb)
#else #else
typedef struct __stat64 mrb_stat; typedef struct __stat64 mrb_stat;
# define mrb_stat(path, sb) _stat64(path, sb) # define mrb_stat(path, sb) _stat64(path, sb)
...@@ -393,7 +397,7 @@ mrb_file_mtime(mrb_state *mrb, mrb_value self) ...@@ -393,7 +397,7 @@ mrb_file_mtime(mrb_state *mrb, mrb_value self)
int fd = mrb_io_fileno(mrb, self); int fd = mrb_io_fileno(mrb, self);
struct stat st; struct stat st;
if (fstat(fd, &st) == -1) if (mrb_fstat(fd, &st) == -1)
return mrb_false_value(); return mrb_false_value();
return mrb_fixnum_value((mrb_int)st.st_mtime); return mrb_fixnum_value((mrb_int)st.st_mtime);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment