diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-06-14 01:49:23 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-06-14 01:49:23 +0000 |
| commit | 0e27cd8c4f88f0948494ddb67d8bf390284e5afe (patch) | |
| tree | 169f53312094825df58a8bf0693507723756745d /file.c | |
| parent | 60fb12e7206030702a132c9382f73cf7016a9cde (diff) | |
| download | ruby-0e27cd8c4f88f0948494ddb67d8bf390284e5afe.tar.gz ruby-0e27cd8c4f88f0948494ddb67d8bf390284e5afe.tar.xz ruby-0e27cd8c4f88f0948494ddb67d8bf390284e5afe.zip | |
* file.c (rb_find_file_ext, rb_find_file): canonicalize absolute
paths. [ruby-core:23845]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
| -rw-r--r-- | file.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -4621,12 +4621,11 @@ rb_find_file_ext(VALUE *filep, const char *const *ext) } if (is_absolute_path(f) || is_explicit_relative(f)) { - fname = rb_str_dup(*filep); + fname = rb_file_expand_path(*filep, Qnil); fnlen = RSTRING_LEN(fname); for (i=0; ext[i]; i++) { rb_str_cat2(fname, ext[i]); if (file_load_ok(StringValueCStr(fname))) { - if (!is_absolute_path(f)) fname = rb_file_expand_path(fname, Qnil); OBJ_FREEZE(fname); *filep = fname; return (int)(i+1); @@ -4685,7 +4684,7 @@ rb_find_file(VALUE path) rb_raise(rb_eSecurityError, "loading from unsafe file %s", f); } if (!file_load_ok(f)) return 0; - if (!is_absolute_path(f)) path = rb_file_expand_path(path, Qnil); + path = rb_file_expand_path(path, Qnil); return path; } |
