summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-22 15:45:00 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-22 15:45:00 +0000
commit86dc863bd84ce79d48e5ada9f57bbe24b97db948 (patch)
tree0f09d8edf917936b230dc8855bed33d0dc3ecc17 /file.c
parent900ede40532640376f7a2ee359e70df2a546e060 (diff)
* win32/win32.c, include/ruby/win32.h (ustatfs): implementation of
statfs(2) clone. [EXPERIMENTAL] * file.c (rb_io_statfs): use above function. * configure.in, win32/Makefile.sub (struct statfs): available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r--file.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/file.c b/file.c
index a8ac67eb4a..8c455121de 100644
--- a/file.c
+++ b/file.c
@@ -115,6 +115,8 @@ static VALUE rb_statfs_new(const struct statfs *st);
#define unlink(p) rb_w32_uunlink(p)
#undef rename
#define rename(f, t) rb_w32_urename((f), (t))
+#undef statfs
+#define statfs(f, s) ustatfs((f), (s))
#else
#define STAT(p, s) stat((p), (s))
#endif
@@ -1118,12 +1120,16 @@ rb_io_statfs(VALUE obj)
{
rb_io_t *fptr;
struct statfs st;
+#ifndef HAVE_FSTATFS
+ VALUE path;
+#endif
GetOpenFile(obj, fptr);
#ifdef HAVE_FSTATFS
if (fstatfs(fptr->fd, &st) == -1)
#else
- if (statfs(RSTRING_PTR(fptr->pathv), &st) == -1)
+ path = rb_str_encode_ospath(fptr->pathv);
+ if (statfs(StringValueCStr(path), &st) == -1)
#endif
{
rb_sys_fail_path(fptr->pathv);