summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-21 01:40:41 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-21 01:40:41 +0000
commit4442095d4cf09ce6042a4a6eb32a7b105c286733 (patch)
tree852270582c50b49d9f5ec6422dde54aab5eecaa1 /io.c
parent05a157ed8a0f0c149e7b66331209ef87fe6225a9 (diff)
* io.c (rb_file_open_internal): should initialize fmode before using.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/io.c b/io.c
index 29b98d0bac..29be9e13ee 100644
--- a/io.c
+++ b/io.c
@@ -4150,10 +4150,10 @@ rb_file_open_generic(VALUE io, VALUE filename, int oflags, int fmode, convconfig
static VALUE
rb_file_open_internal(VALUE io, VALUE filename, const char *modestr)
{
- int fmode;
-
+ int fmode = rb_io_modestr_fmode(modestr);
const char *p = strchr(modestr, ':');
convconfig_t convconfig;
+
if (p) {
parse_mode_enc(p+1, &convconfig.enc, &convconfig.enc2);
}
@@ -4167,7 +4167,6 @@ rb_file_open_internal(VALUE io, VALUE filename, const char *modestr)
convconfig.ecopts = Qnil;
}
- fmode = rb_io_modestr_fmode(modestr);
return rb_file_open_generic(io, filename,
rb_io_fmode_oflags(fmode),
fmode,