diff options
author | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-05-12 08:42:30 +0000 |
---|---|---|
committer | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-05-12 08:42:30 +0000 |
commit | 96ffcf557bb93f891ab9f75053a0b9edda62d064 (patch) | |
tree | 2b0753c2c436ccaaf07259944739dc05aec43ac3 /file.c | |
parent | 93d061a8fd774022f654f4d8fd72963647381920 (diff) | |
download | ruby-96ffcf557bb93f891ab9f75053a0b9edda62d064.tar.gz |
* 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.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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 |