aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-09 08:29:38 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-09 08:29:38 +0000
commit329193624ef6a93793a0fa4e4ba263cdbbebbf40 (patch)
tree833b5c9d661fb03f97727d213f21f5b059d00580 /io.c
parentf60fe393eed70b3fb914b57dcb5a85e72b380b97 (diff)
downloadruby-329193624ef6a93793a0fa4e4ba263cdbbebbf40.tar.gz
io.c: fix non-ascii filename inplace edit
* io.c (argf_next_argv): convert filename to the OS encoding to be dealt with by system calls. [ruby-dev:50607] [Bug #14970] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/io.c b/io.c
index 1d7626c089..9c8d5de03d 100644
--- a/io.c
+++ b/io.c
@@ -8502,6 +8502,7 @@ argf_next_argv(VALUE argf)
VALUE filename = rb_ary_shift(ARGF.argv);
FilePathValue(filename);
ARGF.filename = filename;
+ filename = rb_str_encode_ospath(filename);
fn = StringValueCStr(filename);
if (RSTRING_LEN(filename) == 1 && fn[0] == '-') {
ARGF.current_file = rb_stdin;
@@ -8603,6 +8604,7 @@ argf_next_argv(VALUE argf)
if (!NIL_P(write_io)) {
rb_io_set_write_io(ARGF.current_file, write_io);
}
+ RB_GC_GUARD(filename);
}
if (ARGF.binmode) rb_io_ascii8bit_binmode(ARGF.current_file);
GetOpenFile(ARGF.current_file, fptr);