From 439ad47eb8a9d141d818eada9ce71503a4fb1d85 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 14 Jun 2009 01:49:23 +0000 Subject: [PATCH] * file.c (rb_find_file_ext, rb_find_file): canonicalize absolute paths. [ruby-core:23845] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 ++++- file.c | 5 ++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c12026493d..8855bd706c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ -Sun Jun 14 10:23:16 2009 Nobuyoshi Nakada +Sun Jun 14 10:49:18 2009 Nobuyoshi Nakada + + * file.c (rb_find_file_ext, rb_find_file): canonicalize absolute + paths. [ruby-core:23845] * file.c (rb_file_size): added rdoc. a patch from Run Paint Run Run at [ruby-core:23839]. diff --git a/file.c b/file.c index 089435cfca..41080ff238 100644 --- a/file.c +++ b/file.c @@ -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; }