diff options
| author | Yasuhiro Matsumoto <[email protected]> | 2017-12-12 16:09:10 +0900 |
|---|---|---|
| committer | Yasuhiro Matsumoto <[email protected]> | 2017-12-12 18:52:40 +0900 |
| commit | 977f79478fbadd9ed6d55c8bd7a6fc1deb5c78fc (patch) | |
| tree | 5dcc4941f6f582de6c322e15f830cee37b94ffff /mrbgems/mruby-io | |
| parent | a9e434e69aa4441e26a9bc970d7a4a4dea665980 (diff) | |
| download | mruby-977f79478fbadd9ed6d55c8bd7a6fc1deb5c78fc.tar.gz mruby-977f79478fbadd9ed6d55c8bd7a6fc1deb5c78fc.zip | |
use filename in locale
Diffstat (limited to 'mrbgems/mruby-io')
| -rw-r--r-- | mrbgems/mruby-io/src/io.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mrbgems/mruby-io/src/io.c b/mrbgems/mruby-io/src/io.c index b3166b11b..c015018c9 100644 --- a/mrbgems/mruby-io/src/io.c +++ b/mrbgems/mruby-io/src/io.c @@ -557,6 +557,7 @@ mrb_cloexec_open(mrb_state *mrb, const char *pathname, mrb_int flags, mrb_int mo { mrb_value emsg; int fd, retry = FALSE; + char* utf8 = mrb_locale_from_utf8(pathname, -1); #ifdef O_CLOEXEC /* O_CLOEXEC is available since Linux 2.6.23. Linux 2.6.18 silently ignore it. */ @@ -565,7 +566,7 @@ mrb_cloexec_open(mrb_state *mrb, const char *pathname, mrb_int flags, mrb_int mo flags |= O_NOINHERIT; #endif reopen: - fd = open(pathname, (int)flags, mode); + fd = open(utf8, (int)flags, mode); if (fd == -1) { if (!retry) { switch (errno) { @@ -581,6 +582,7 @@ reopen: mrb_str_modify(mrb, mrb_str_ptr(emsg)); mrb_sys_fail(mrb, RSTRING_PTR(emsg)); } + mrb_utf8_free(utf8); if (fd <= 2) { mrb_fd_cloexec(mrb, fd); |
