ruby-changes:38755
From: nagachika <ko1@a...>
Date: Fri, 12 Jun 2015 01:15:03 +0900 (JST)
Subject: [ruby-changes:38755] nagachika:r50836 (ruby_2_2): merge revision(s) 50637: [Backport #11172]
nagachika 2015-06-12 01:14:45 +0900 (Fri, 12 Jun 2015) New Revision: 50836 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50836 Log: 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). Modified directories: branches/ruby_2_2/ Modified files: branches/ruby_2_2/ChangeLog branches/ruby_2_2/version.h branches/ruby_2_2/win32/win32.c Index: ruby_2_2/ChangeLog =================================================================== --- ruby_2_2/ChangeLog (revision 50835) +++ ruby_2_2/ChangeLog (revision 50836) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1 +Fri Jun 12 01:14:00 2015 NARUSE, Yui <naruse@r...> + + * win32/win32.c (setup_overlapped): seek to the file end only when + writing (mode:a), not reading (mode:a+, read). + Fri Jun 12 01:11:52 2015 Aaron Patterson <tenderlove@r...> * load.c (loaded_feature_path): stop returning false negatives for Index: ruby_2_2/win32/win32.c =================================================================== --- ruby_2_2/win32/win32.c (revision 50835) +++ ruby_2_2/win32/win32.c (revision 50836) @@ -6318,12 +6318,16 @@ rb_w32_close(int fd) https://github.com/ruby/ruby/blob/trunk/ruby_2_2/win32/win32.c#L6318 } 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) @@ -6420,7 +6424,7 @@ rb_w32_read(int fd, void *buf, size_t si https://github.com/ruby/ruby/blob/trunk/ruby_2_2/win32/win32.c#L6424 /* 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; } @@ -6550,7 +6554,7 @@ rb_w32_write(int fd, const void *buf, si https://github.com/ruby/ruby/blob/trunk/ruby_2_2/win32/win32.c#L6554 /* 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; } Index: ruby_2_2/version.h =================================================================== --- ruby_2_2/version.h (revision 50835) +++ ruby_2_2/version.h (revision 50836) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1 #define RUBY_VERSION "2.2.3" #define RUBY_RELEASE_DATE "2015-06-12" -#define RUBY_PATCHLEVEL 130 +#define RUBY_PATCHLEVEL 131 #define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_MONTH 6 Property changes on: ruby_2_2 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r50637 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/