summaryrefslogtreecommitdiff
path: root/load.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-09 01:03:15 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-09 01:03:15 (GMT)
commit56417d1f24ab6f505f431de067d3cfa596600c65 (patch)
treedbb6734b851f47478da812cd29d22990fc652b62 /load.c
parent7aa83cd0f88743443da35d202a94b64fcadf3b6c (diff)
load.c: raise name before conversion
* load.c (rb_f_load): raise with the original path name before encoding conversion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'load.c')
-rw-r--r--load.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/load.c b/load.c
index a3b32d4..fc2e44b 100644
--- a/load.c
+++ b/load.c
@@ -698,13 +698,16 @@ static VALUE
rb_f_load(int argc, VALUE *argv)
{
VALUE fname, wrap, path, orig_fname;
+ int safe;
rb_scan_args(argc, argv, "11", &fname, &wrap);
RUBY_DTRACE_HOOK(LOAD_ENTRY, StringValuePtr(fname));
- orig_fname = FilePathValue(fname);
- fname = rb_str_encode_ospath(orig_fname);
+ safe = rb_safe_level();
+ orig_fname = rb_get_path_check_to_string(fname, safe);
+ fname = rb_get_path_check_convert(fname, orig_fname, safe);
+ fname = rb_str_encode_ospath(fname);
path = rb_find_file(fname);
if (!path) {
if (!rb_file_load_ok(RSTRING_PTR(fname)))