[前][次][番号順一覧][スレッド一覧]

ruby-changes:38725

From: usa <ko1@a...>
Date: Tue, 9 Jun 2015 16:25:27 +0900 (JST)
Subject: [ruby-changes:38725] usa:r50806 (ruby_2_1): merge revision(s) 50637: [Backport #11172]

usa	2015-06-09 16:25:08 +0900 (Tue, 09 Jun 2015)

  New Revision: 50806

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50806

  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_1/
  Modified files:
    branches/ruby_2_1/ChangeLog
    branches/ruby_2_1/version.h
    branches/ruby_2_1/win32/win32.c
Index: ruby_2_1/ChangeLog
===================================================================
--- ruby_2_1/ChangeLog	(revision 50805)
+++ ruby_2_1/ChangeLog	(revision 50806)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Tue Jun  9 16:24:25 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).
+
 Tue Jun  9 16:15:31 2015  Aaron Patterson <tenderlove@r...>
 
 	* load.c (loaded_feature_path): stop returning false negatives for
Index: ruby_2_1/win32/win32.c
===================================================================
--- ruby_2_1/win32/win32.c	(revision 50805)
+++ ruby_2_1/win32/win32.c	(revision 50806)
@@ -6274,12 +6274,16 @@ rb_w32_close(int fd) https://github.com/ruby/ruby/blob/trunk/ruby_2_1/win32/win32.c#L6274
 }
 
 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 si https://github.com/ruby/ruby/blob/trunk/ruby_2_1/win32/win32.c#L6380
 
     /* 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, si https://github.com/ruby/ruby/blob/trunk/ruby_2_1/win32/win32.c#L6498
 
     /* 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_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 50805)
+++ ruby_2_1/version.h	(revision 50806)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #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

Property changes on: ruby_2_1
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r50637


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]