diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-05-30 04:44:42 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-05-30 04:44:42 +0000 |
commit | 475907ecf0d9923533f61d604dcd0e466ca41200 (patch) | |
tree | 851f73126ef5c29359b0cf7a552bbd2e0e6befd2 | |
parent | 1049a5df6d9975661bce0cb8a13cf66be907231d (diff) |
merges r31351 and r31352 from trunk into ruby_1_9_2.
--
* include/ruby/win32.h (ftruncate, truncate, ftello, fseeko): non-64
versions on mingw are useless because they use int32_t. fixes #4564
--
* file.c (rb_file_truncate): fix function.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@31817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | configure.in | 1 | ||||
-rw-r--r-- | file.c | 2 | ||||
-rw-r--r-- | include/ruby/win32.h | 37 | ||||
-rw-r--r-- | version.h | 2 |
5 files changed, 40 insertions, 9 deletions
@@ -1,3 +1,10 @@ +Wed Apr 27 00:51:01 2011 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * file.c (rb_file_truncate): fix function. + + * include/ruby/win32.h (ftruncate, truncate, ftello, fseeko): non-64 + versions on mingw are useless because they use int32_t. fixes #4564 + Mon Apr 25 21:31:36 2011 Nobuhiro Iwamatsu <iwamatsu@nigauri.org> * ext/openssl/extconf.rb: Should check SSLv2_*method. diff --git a/configure.in b/configure.in index b15470b243..adcfddac96 100644 --- a/configure.in +++ b/configure.in @@ -1186,6 +1186,7 @@ else fi AC_CHECK_FUNCS(fmod killpg wait4 waitpid fork spawnv syscall __syscall chroot getcwd eaccess\ truncate ftruncate ftello chsize times utimes utimensat fcntl lockf lstat\ + truncate64 ftruncate64 ftello64 fseeko fseeko64 \ link symlink readlink readdir_r fsync fdatasync fchown\ setitimer setruid seteuid setreuid setresuid setproctitle socketpair\ setrgid setegid setregid setresgid issetugid pause lchown lchmod\ @@ -3913,7 +3913,7 @@ rb_file_truncate(VALUE obj, VALUE len) rb_sys_fail_path(fptr->pathv); #else /* defined(HAVE_CHSIZE) */ if (chsize(fptr->fd, pos) < 0) - rb_sys_fail(fptr->pathv); + rb_sys_fail_path(fptr->pathv); #endif return INT2FIX(0); } diff --git a/include/ruby/win32.h b/include/ruby/win32.h index 32b61d38da..79eb6a19df 100644 --- a/include/ruby/win32.h +++ b/include/ruby/win32.h @@ -94,6 +94,9 @@ typedef unsigned int uintptr_t; #ifndef __MINGW32__ # define mode_t int #endif +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif #ifdef WIN95 extern DWORD rb_w32_osid(void); @@ -371,21 +374,41 @@ scalb(double a, long b) #define SUFFIX -#if !defined HAVE_FTRUNCATE || defined(_MSC_VER) +extern int rb_w32_ftruncate(int fd, off_t length); +extern int rb_w32_truncate(const char *path, off_t length); +extern off_t rb_w32_ftello(FILE *stream); +extern int rb_w32_fseeko(FILE *stream, off_t offset, int whence); + +#undef HAVE_FTRUNCATE +#define HAVE_FTRUNCATE 1 +#if defined HAVE_FTRUNCATE64 +#define ftruncate ftruncate64 +#else #define ftruncate rb_w32_ftruncate #endif -extern int ftruncate(int fd, off_t length); -#if !defined HAVE_TRUNCATE || defined(_MSC_VER) +#undef HAVE_TRUNCATE +#define HAVE_TRUNCATE 1 +#if defined HAVE_TRUNCATE64 +#define truncate truncate64 +#else #define truncate rb_w32_truncate #endif -extern int truncate(const char *path, off_t length); -extern int fseeko(FILE *stream, off_t offset, int whence); +#undef HAVE_FSEEKO +#define HAVE_FSEEKO 1 +#if defined HAVE_FSEEKO64 +#define fseeko fseeko64 +#else +#define fseeko rb_w32_fseeko +#endif -#if !defined HAVE_FTELLO || defined(_MSC_VER) +#undef HAVE_FTELLO +#define HAVE_FTELLO 1 +#if defined HAVE_FTELLO64 +#define ftello ftello64 +#else #define ftello rb_w32_ftello -extern off_t rb_w32_ftello(FILE *stream); #endif // @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 241 +#define RUBY_PATCHLEVEL 242 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 |