summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-08 12:37:19 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-08 12:37:19 +0000
commite9f4ad970a876fa65d3476df9a85c2a28a8137c5 (patch)
treee8278e734167a6b831cb71dc3a8266cc0d9414cd /lib
parent1f1d15f8994206f52d04c5dc55820eef02bee900 (diff)
* 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
Diffstat (limited to 'lib')
-rw-r--r--lib/fileutils.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/fileutils.rb b/lib/fileutils.rb
index 08e21a07d2..20177a048c 100644
--- a/lib/fileutils.rb
+++ b/lib/fileutils.rb
@@ -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)