summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-09 07:25:08 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-09 07:25:08 +0000
commit16b551feb5b9b110eb3a4c6528e8fea1e0a174b5 (patch)
treeed43d55eab3513e8e007f1e55b5246404eefe391
parent4def2274b2685eab2c2a3bc4cd831faf1382e5e9 (diff)
merge revision(s) 50637: [Backport #11172]
* win32/win32.c (setup_overlapped): seek to the file end only when writing (mode:a), not reading (mode:a+, read). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@50806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--version.h2
-rw-r--r--win32/win32.c12
3 files changed, 14 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index bcd48a7283..9278a79037 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Jun 9 16:24:25 2015 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * win32/win32.c (setup_overlapped): seek to the file end only when
+ writing (mode:a), not reading (mode:a+, read).
+
Tue Jun 9 16:15:31 2015 Aaron Patterson <tenderlove@ruby-lang.org>
* load.c (loaded_feature_path): stop returning false negatives for
diff --git a/version.h b/version.h
index 90db321fc8..87e80ef16b 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.1.7"
#define RUBY_RELEASE_DATE "2015-06-09"
-#define RUBY_PATCHLEVEL 363
+#define RUBY_PATCHLEVEL 364
#define RUBY_RELEASE_YEAR 2015
#define RUBY_RELEASE_MONTH 6
diff --git a/win32/win32.c b/win32/win32.c
index ed5bfa778e..203e21b09f 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -6274,12 +6274,16 @@ rb_w32_close(int fd)
}
static int
-setup_overlapped(OVERLAPPED *ol, int fd)
+setup_overlapped(OVERLAPPED *ol, int fd, int iswrite)
{
memset(ol, 0, sizeof(*ol));
if (!(_osfile(fd) & (FDEV | FPIPE))) {
LONG high = 0;
- DWORD method = _osfile(fd) & FAPPEND ? FILE_END : FILE_CURRENT;
+ /* On mode:a, it can write only FILE_END.
+ * On mode:a+, though it can write only FILE_END,
+ * it can read from everywhere.
+ */
+ DWORD method = ((_osfile(fd) & FAPPEND) && iswrite) ? FILE_END : FILE_CURRENT;
DWORD low = SetFilePointer((HANDLE)_osfhnd(fd), 0, &high, method);
#ifndef INVALID_SET_FILE_POINTER
#define INVALID_SET_FILE_POINTER ((DWORD)-1)
@@ -6376,7 +6380,7 @@ rb_w32_read(int fd, void *buf, size_t size)
/* if have cancel_io, use Overlapped I/O */
if (cancel_io) {
- if (setup_overlapped(&ol, fd)) {
+ if (setup_overlapped(&ol, fd, FALSE)) {
MTHREAD_ONLY(LeaveCriticalSection(&_pioinfo(fd)->lock));
return -1;
}
@@ -6494,7 +6498,7 @@ rb_w32_write(int fd, const void *buf, size_t size)
/* if have cancel_io, use Overlapped I/O */
if (cancel_io) {
- if (setup_overlapped(&ol, fd)) {
+ if (setup_overlapped(&ol, fd, TRUE)) {
MTHREAD_ONLY(LeaveCriticalSection(&_pioinfo(fd)->lock));
return -1;
}