* lib/fileutils.rb (fu_traverse): return value of Dir.entries is reliable. (pass $SAFE=1)

* lib/fileutils.rb (remove_dir): return value of Dir.foreach is reliable. (pass $SAFE=1)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
aamine 2004-10-08 12:37:19 +00:00
parent 1f1d15f899
commit e9f4ad970a
2 changed files with 11 additions and 3 deletions

View File

@ -1,3 +1,11 @@
Fri Oct 8 21:36:56 2004 Minero Aoki <aamine@loveruby.net>
* lib/fileutils.rb (fu_traverse): return value of Dir.entries is
reliable. (pass $SAFE=1)
* lib/fileutils.rb (remove_dir): return value of Dir.foreach is
reliable. (pass $SAFE=1)
Fri Oct 8 09:49:32 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* pack.c (pack_pack): pointer modification check before each

View File

@ -385,7 +385,7 @@ module FileUtils
if st.directory? and (deref or not st.symlink?)
stack.concat Dir.entries("#{prefix}/#{rel}")\
.reject {|ent| ent == '.' or ent == '..' }\
.map {|ent| "#{rel}/#{ent}" }.reverse
.map {|ent| "#{rel}/#{ent.untaint}" }.reverse
end
yield rel, deref, st
deref = false
@ -692,8 +692,8 @@ module FileUtils
def remove_dir(dir, force = false) #:nodoc:
Dir.foreach(dir) do |file|
next if /\A\.\.?\z/ === file
path = "#{dir}/#{file}"
next if /\A\.\.?\z/ =~ file
path = "#{dir}/#{file.untaint}"
if File.symlink?(path)
remove_file path, force
elsif File.directory?(path)