diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-18 16:33:46 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-18 16:33:46 +0000 |
commit | 02f43f1bd92cd8eb016b44d98a2b86173c520211 (patch) | |
tree | c31859931992245ab5b0e75de06d8110a866b373 /io.c | |
parent | 20d2ecafa30f84e13242a2cf221d24bb8be5e7ed (diff) | |
download | ruby-02f43f1bd92cd8eb016b44d98a2b86173c520211.tar.gz |
* io.c (rb_open_file): encoding in mode string was ignored if perm is
specified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -4506,6 +4506,12 @@ rb_open_file(int argc, VALUE *argv, VALUE io) fmode = NIL_P(perm) ? 0666 : NUM2UINT(perm); rb_file_sysopen_internal(io, RSTRING_PTR(fname), flags, fmode); + + if (!FIXNUM_P(vmode)) { + rb_io_t *fptr; + GetOpenFile(io, fptr); + rb_io_mode_enc(fptr, StringValueCStr(vmode)); + } } else { mode = NIL_P(vmode) ? "r" : StringValueCStr(vmode); |