mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Refactor
* lib/fileutils.rb (FileUtils::Entry_#copy_metadata): eliminate common statements. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4c4f809e93
commit
71db7bd3d3
1 changed files with 8 additions and 15 deletions
|
@ -1273,6 +1273,7 @@ module FileUtils
|
|||
if !st.symlink?
|
||||
File.utime st.atime, st.mtime, path
|
||||
end
|
||||
mode = st.mode
|
||||
begin
|
||||
if st.symlink?
|
||||
begin
|
||||
|
@ -1284,23 +1285,15 @@ module FileUtils
|
|||
end
|
||||
rescue Errno::EPERM
|
||||
# clear setuid/setgid
|
||||
if st.symlink?
|
||||
begin
|
||||
File.lchmod st.mode & 01777, path
|
||||
rescue NotImplementedError
|
||||
end
|
||||
else
|
||||
File.chmod st.mode & 01777, path
|
||||
mode &= 01777
|
||||
end
|
||||
if st.symlink?
|
||||
begin
|
||||
File.lchmod mode, path
|
||||
rescue NotImplementedError
|
||||
end
|
||||
else
|
||||
if st.symlink?
|
||||
begin
|
||||
File.lchmod st.mode, path
|
||||
rescue NotImplementedError
|
||||
end
|
||||
else
|
||||
File.chmod st.mode, path
|
||||
end
|
||||
File.chmod mode, path
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue