mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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:
parent
1f1d15f899
commit
e9f4ad970a
2 changed files with 11 additions and 3 deletions
|
@ -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>
|
Fri Oct 8 09:49:32 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* pack.c (pack_pack): pointer modification check before each
|
* pack.c (pack_pack): pointer modification check before each
|
||||||
|
|
|
@ -385,7 +385,7 @@ module FileUtils
|
||||||
if st.directory? and (deref or not st.symlink?)
|
if st.directory? and (deref or not st.symlink?)
|
||||||
stack.concat Dir.entries("#{prefix}/#{rel}")\
|
stack.concat Dir.entries("#{prefix}/#{rel}")\
|
||||||
.reject {|ent| ent == '.' or ent == '..' }\
|
.reject {|ent| ent == '.' or ent == '..' }\
|
||||||
.map {|ent| "#{rel}/#{ent}" }.reverse
|
.map {|ent| "#{rel}/#{ent.untaint}" }.reverse
|
||||||
end
|
end
|
||||||
yield rel, deref, st
|
yield rel, deref, st
|
||||||
deref = false
|
deref = false
|
||||||
|
@ -692,8 +692,8 @@ module FileUtils
|
||||||
|
|
||||||
def remove_dir(dir, force = false) #:nodoc:
|
def remove_dir(dir, force = false) #:nodoc:
|
||||||
Dir.foreach(dir) do |file|
|
Dir.foreach(dir) do |file|
|
||||||
next if /\A\.\.?\z/ === file
|
next if /\A\.\.?\z/ =~ file
|
||||||
path = "#{dir}/#{file}"
|
path = "#{dir}/#{file.untaint}"
|
||||||
if File.symlink?(path)
|
if File.symlink?(path)
|
||||||
remove_file path, force
|
remove_file path, force
|
||||||
elsif File.directory?(path)
|
elsif File.directory?(path)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue