summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-09-25 07:07:43 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-09-25 07:07:43 +0000
commitf33958990a43b8a20ad7ed7eb1d30ec211b46f85 (patch)
treef962530dd96d7c293cba9d8f4bd6318d688c33f2 /file.c
parentd65fac5daa6838c9c56c6b6dd2f3127fe229d4e8 (diff)
* eval.c (ruby_run): should set toplevel visibility again here.
* eval.c (rb_eval): should not rely on ruby_class == rb_cObject check. Besides allow implicit publicity for attribute set methods. * parse.y (primary): need not to check class_nest, just set whether method is an attrset or not. * string.c (rb_str_each_line): p might be at the top of the string. * variable.c (rb_path2class): should not use rb_eval_string(). * parse.y (str_extend): expression substitution can contain string terminator again. * parse.y (yylex): the warning message "invalid character syntax" was never issued. * file.c (rb_find_file): $LOAD_PATH must not be empty. * file.c (rb_find_file_ext): ditto. * range.c (range_eq): class check should be based on range.class, instead of Range to work with Range.dup. * range.c (range_eql): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@2888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r--file.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/file.c b/file.c
index 3243f41c4c..9a0789b5f6 100644
--- a/file.c
+++ b/file.c
@@ -2198,6 +2198,7 @@ rb_find_file_ext(filep, ext)
VALUE str = RARRAY(rb_load_path)->ptr[i];
Check_SafeStr(str);
+ if (RSTRING(str)->len == 0) return 0;
path = RSTRING(str)->ptr;
for (j=0; ext[j]; j++) {
fname = rb_str_dup(*filep);
@@ -2262,15 +2263,23 @@ rb_find_file(path)
}
}
tmp = rb_ary_join(tmp, rb_str_new2(PATH_SEP));
- lpath = STR2CSTR(tmp);
- if (rb_safe_level() >= 2 && !rb_path_check(lpath)) {
- rb_raise(rb_eSecurityError, "loading from unsafe path %s", lpath);
+ if (RSTRING(tmp)->len == 0) {
+ lpath = 0;
+ }
+ else {
+ lpath = STR2CSTR(tmp);
+ if (rb_safe_level() >= 2 && !rb_path_check(lpath)) {
+ rb_raise(rb_eSecurityError, "loading from unsafe path %s", lpath);
+ }
}
}
else {
lpath = 0;
}
+ if (!lpath) {
+ return 0; /* no path, no load */
+ }
f = dln_find_file(f, lpath);
if (file_load_ok(f)) {
return rb_str_new2(f);