summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-12 08:42:30 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-12 08:42:30 +0000
commit96ffcf557bb93f891ab9f75053a0b9edda62d064 (patch)
tree2b0753c2c436ccaaf07259944739dc05aec43ac3 /file.c
parent93d061a8fd774022f654f4d8fd72963647381920 (diff)
* file.c (rb_file_s_truncate): use correct type. chsize takes
a long. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40668 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 3b52c900a1..9b6ae64ae1 100644
--- a/file.c
+++ b/file.c
@@ -4098,10 +4098,16 @@ rb_file_s_join(VALUE klass, VALUE args)
static VALUE
rb_file_s_truncate(VALUE klass, VALUE path, VALUE len)
{
+#ifdef HAVE_TRUNCATE
+#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);
FilePathValue(path);
path = rb_str_encode_ospath(path);
#ifdef HAVE_TRUNCATE
@@ -4123,6 +4129,7 @@ rb_file_s_truncate(VALUE klass, VALUE path, VALUE len)
}
#endif
return INT2FIX(0);
+#undef NUM2POS
}
#else
#define rb_file_s_truncate rb_f_notimplement