diff --git a/ChangeLog b/ChangeLog index c7660793a5..952418ffae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Tue Oct 21 10:40:37 2008 Nobuyoshi Nakada + + * io.c (rb_file_open_internal): should initialize fmode before using. + Tue Oct 21 08:56:37 2008 Nobuyoshi Nakada * regparse.c (parse_char_class): CCV_SB is only for single 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,