summaryrefslogtreecommitdiff
path: root/mjit.c
diff options
context:
space:
mode:
Diffstat (limited to 'mjit.c')
-rw-r--r--mjit.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/mjit.c b/mjit.c
index acd4ea3d27..6f186c03b7 100644
--- a/mjit.c
+++ b/mjit.c
@@ -1227,8 +1227,11 @@ system_tmpdir(void)
WCHAR tmppath[_MAX_PATH];
UINT len = rb_w32_system_tmpdir(tmppath, numberof(tmppath));
if (len) {
- tmpdir = rb_w32_wstr_to_mbstr(CP_UTF8, tmppath, -1, NULL);
- return get_string(tmpdir);
+ int blen = WideCharToMultiByte(CP_UTF8, 0, tmppath, len, NULL, 0, NULL, NULL);
+ tmpdir= xmalloc(blen + 1);
+ WideCharToMultiByte(CP_UTF8, 0, tmppath, len, tmpdir, blen, NULL, NULL);
+ tmpdir[blen] = '\0';
+ return tmpdir;
}
#elif defined _CS_DARWIN_USER_TEMP_DIR
#ifndef MAXPATHLEN