diff options
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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 |