1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* file.c (rb_io_stafs): use statfs(2) if fstatfs(2) is unavailable.

* configure.in (fstatfs): check it.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2014-04-22 14:57:18 +00:00
parent a197581765
commit 900ede4053
3 changed files with 13 additions and 1 deletions

View file

@ -1,3 +1,9 @@
Tue Apr 22 23:56:24 2014 NAKAMURA Usaku <usa@ruby-lang.org>
* file.c (rb_io_stafs): use statfs(2) if fstatfs(2) is unavailable.
* configure.in (fstatfs): check it.
Tue Apr 22 23:14:28 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/stringio/stringio.c (strio_write): use rb_str_append to

View file

@ -1946,6 +1946,7 @@ AC_CHECK_FUNCS(fcntl)
AC_CHECK_FUNCS(fdatasync)
AC_CHECK_FUNCS(fmod)
AC_CHECK_FUNCS(fork)
AC_CHECK_FUNCS(fstatfs)
AC_CHECK_FUNCS(fsync)
AC_CHECK_FUNCS(ftruncate)
AC_CHECK_FUNCS(ftruncate64) # used for Win32 platform

7
file.c
View file

@ -1120,7 +1120,12 @@ rb_io_statfs(VALUE obj)
struct statfs st;
GetOpenFile(obj, fptr);
if (fstatfs(fptr->fd, &st) == -1) {
#ifdef HAVE_FSTATFS
if (fstatfs(fptr->fd, &st) == -1)
#else
if (statfs(RSTRING_PTR(fptr->pathv), &st) == -1)
#endif
{
rb_sys_fail_path(fptr->pathv);
}
return rb_statfs_new(&st);