summaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-22 02:15:35 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-22 02:15:35 +0000
commitd9284f943119ddcbaaf4b3ea3695f3f27d33691e (patch)
treed12afdc9ca3d39bb2624dba15b7ae1d7c5099433 /io.c
parentaad987120da05942fb918eb80c357747474fe9a5 (diff)
downloadruby-d9284f943119ddcbaaf4b3ea3695f3f27d33691e.tar.gz
ruby-d9284f943119ddcbaaf4b3ea3695f3f27d33691e.tar.xz
ruby-d9284f943119ddcbaaf4b3ea3695f3f27d33691e.zip
* io.c (rb_io_mode_modenum): replace O_ACCMODE with O_RDWR.
fixed: [ruby-dev:25273] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7632 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/io.c b/io.c
index 8256b5778..e2547bc54 100644
--- a/io.c
+++ b/io.c
@@ -84,6 +84,10 @@ extern void Init_File _((void));
#include "util.h"
+#ifndef O_ACCMODE
+#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
+#endif
+
#if SIZEOF_OFF_T > SIZEOF_LONG && !defined(HAVE_LONG_LONG)
# error off_t is bigger than long, but you have no long long...
#endif
@@ -2469,7 +2473,7 @@ rb_io_mode_modenum(mode)
#endif
break;
case '+':
- flags |= O_RDWR;
+ flags = (flags & ~O_ACCMODE) | O_RDWR;
break;
default:
goto error;