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

ruby-changes:40062

From: nobu <ko1@a...>
Date: Sat, 17 Oct 2015 13:03:38 +0900 (JST)
Subject: [ruby-changes:40062] nobu:r52143 (trunk): ruby.c: conflicting O_NONBLOCK

nobu	2015-10-17 13:03:23 +0900 (Sat, 17 Oct 2015)

  New Revision: 52143

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

  Log:
    ruby.c: conflicting O_NONBLOCK
    
    * ruby.c (load_file_internal): do not use O_NONBLOCK when
      conflicting with O_ACCMODE.

  Modified files:
    trunk/io.c
    trunk/ruby.c
Index: io.c
===================================================================
--- io.c	(revision 52142)
+++ io.c	(revision 52143)
@@ -4981,7 +4981,7 @@ rb_io_oflags_fmode(int oflags) https://github.com/ruby/ruby/blob/trunk/io.c#L4981
 {
     int fmode = 0;
 
-    switch (oflags & (O_RDONLY|O_WRONLY|O_RDWR)) {
+    switch (oflags & O_ACCMODE) {
       case O_RDONLY:
 	fmode = FMODE_READABLE;
 	break;
Index: ruby.c
===================================================================
--- ruby.c	(revision 52142)
+++ ruby.c	(revision 52143)
@@ -43,6 +43,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby.c#L43
 #ifndef MAXPATHLEN
 # define MAXPATHLEN 1024
 #endif
+#ifndef O_ACCMODE
+# define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
+#endif
 
 #include "ruby/util.h"
 
@@ -1739,9 +1742,10 @@ load_file_internal(VALUE arg) https://github.com/ruby/ruby/blob/trunk/ruby.c#L1742
     }
     else {
 	int fd, mode = O_RDONLY;
-#if defined O_NONBLOCK
+#if defined O_NONBLOCK && !(O_NONBLOCK & O_ACCMODE)
+	/* TODO: fix conflicting O_NONBLOCK in ruby/win32.h */
 	mode |= O_NONBLOCK;
-#elif defined O_NDELAY
+#elif defined O_NDELAY && !(O_NDELAY & O_ACCMODE)
 	mod |= O_NDELAY;
 #endif
 #if defined DOSISH || defined __CYGWIN__

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

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