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

ruby-changes:14783

From: akr <ko1@a...>
Date: Thu, 11 Feb 2010 20:56:12 +0900 (JST)
Subject: [ruby-changes:14783] Ruby:r26645 (ruby_1_8): * io.c (rb_io_modenum_mode): return "r" for O_RDONLY|O_APPEND.

akr	2010-02-11 20:45:56 +0900 (Thu, 11 Feb 2010)

  New Revision: 26645

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

  Log:
    * io.c (rb_io_modenum_mode): return "r" for O_RDONLY|O_APPEND.
      [ruby-dev:40379]

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/io.c

Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 26644)
+++ ruby_1_8/ChangeLog	(revision 26645)
@@ -1,3 +1,8 @@
+Thu Feb 11 20:43:00 2010  Tanaka Akira  <akr@f...>
+
+	* io.c (rb_io_modenum_mode): return "r" for O_RDONLY|O_APPEND.
+	  [ruby-dev:40379]
+
 Thu Feb 11 09:49:31 2010  Tanaka Akira  <akr@f...>
 
 	* lib/resolv.rb: fix [ruby-core:28144] reported by Hans de Graaff.
Index: ruby_1_8/io.c
===================================================================
--- ruby_1_8/io.c	(revision 26644)
+++ ruby_1_8/io.c	(revision 26645)
@@ -2910,13 +2910,16 @@
 #else
 # define MODE_BINARY(a,b) (a)
 #endif
+    int accmode = flags & O_ACCMODE;
     if (flags & O_APPEND) {
-	if ((flags & O_RDWR) == O_RDWR) {
+	if (accmode == O_WRONLY) {
+            return MODE_BINARY("a", "ab");
+        }
+	if (accmode == O_RDWR) {
 	    return MODE_BINARY("a+", "ab+");
 	}
-	return MODE_BINARY("a", "ab");
     }
-    switch (flags & (O_RDONLY|O_WRONLY|O_RDWR)) {
+    switch (accmode) {
       case O_RDONLY:
 	return MODE_BINARY("r", "rb");
       case O_WRONLY:

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

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