summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--configure.in1
-rw-r--r--file.c2
-rw-r--r--include/ruby/win32.h37
-rw-r--r--version.h2
5 files changed, 40 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index e4bd91c97b..fbe6a33f0a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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\
diff --git a/file.c b/file.c
index adc49ef017..b4675ef6a4 100644
--- a/file.c
+++ b/file.c
@@ -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
//
diff --git a/version.h b/version.h
index 9dcc09749f..f2039c8fb5 100644
--- a/version.h
+++ b/version.h
@@ -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