summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-27 02:46:54 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-27 02:46:54 +0000
commitece87af00c6e31181b7092980a351929c5421a43 (patch)
tree69f926f26570f7cbe08fe38dca0c011e8051e945 /io.c
parent5615f7636e54d7010a1974bfa79ef2e31a44ffbd (diff)
* string.c (RESIZE_CAPA): check string attribute before modifying
capacity member of string structure. [ruby-dev:24594] * ext/zlib/zlib.c (gzreader_gets): use memchr() to to gain performance. [ruby-talk:117701] * sprintf.c (rb_f_sprintf): raise ArgumentError for extra arguments, unless (digit)$ style used. * ext/zlib/zlib.c (gzreader_gets): use memchr() to to gain performance. [ruby-talk:117701] * sprintf.c (rb_f_sprintf): raise ArgumentError for extra arguments, unless (digit)$ style used. * eval.c (frame_free): Guy Decoux solved the leak problem. Thanks. [ruby-core:03549] * ext/zlib/zlib.c (zstream_append_input): clear klass for z->input to avoid potential vulnerability. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/io.c b/io.c
index 01ff8c9..87cd6a8 100644
--- a/io.c
+++ b/io.c
@@ -2183,6 +2183,9 @@ rb_io_flags_mode(flags)
case FMODE_WRITABLE:
return MODE_BINMODE("w", "wb");
case FMODE_READWRITE:
+ if (flags & FMODE_CREATE) {
+ return MODE_BINMODE("w+", "wb+");
+ }
return MODE_BINMODE("r+", "rb+");
}
rb_raise(rb_eArgError, "illegal access mode %o", flags);
@@ -2201,10 +2204,10 @@ rb_io_mode_flags(mode)
flags |= FMODE_READABLE;
break;
case 'w':
- flags |= FMODE_WRITABLE;
+ flags |= FMODE_WRITABLE | FMODE_CREATE;
break;
case 'a':
- flags |= FMODE_WRITABLE | FMODE_APPEND;
+ flags |= FMODE_WRITABLE | FMODE_APPEND | FMODE_CREATE;
break;
default:
error: