summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-12 08:41:24 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-12 08:41:24 +0000
commit05628d3b6d49bd301f16acdb882442c81d97475d (patch)
tree1fe1320947bbb0aeb180e26961878d57ca6e3e37 /file.c
parente79f7907987d9dc2445892b7b571a621208d29bf (diff)
* configure.in: removes AC_CHECK_FUNC(ftruncate64).
* configure.in: adds RUBY_REPLACE_TYPE(off_t) for creating NUM2OFFT. * file.c (rb_file_truncate): use correct type. chsize() take a long. * include/ruby/ruby.h (NUM2OFFT): use a definition created by a configure script by default. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r--file.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/file.c b/file.c
index e6fe603a1d..3b52c900a1 100644
--- a/file.c
+++ b/file.c
@@ -4147,10 +4147,16 @@ static VALUE
rb_file_truncate(VALUE obj, VALUE len)
{
rb_io_t *fptr;
+#if defined(HAVE_FTRUNCATE)
+#define NUM2POS(n) NUM2OFFT(n)
off_t pos;
+#else
+#define NUM2POS(n) NUM2LONG(n)
+ long pos;
+#endif
rb_secure(2);
- pos = NUM2OFFT(len);
+ pos = NUM2POS(len);
GetOpenFile(obj, fptr);
if (!(fptr->mode & FMODE_WRITABLE)) {
rb_raise(rb_eIOError, "not opened for writing");
@@ -4164,6 +4170,7 @@ rb_file_truncate(VALUE obj, VALUE len)
rb_sys_fail_path(fptr->pathv);
#endif
return INT2FIX(0);
+#undef NUM2POS
}
#else
#define rb_file_truncate rb_f_notimplement