diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-27 01:24:46 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-27 01:24:46 +0000 |
commit | 71db7bd3d3c87a5390a54a409de06d672ca32b98 (patch) | |
tree | 4e6acb765a8b3968d4bc2a9d25bf6129def495ec /lib | |
parent | 4c4f809e932417137d06e334d79065a4849dda0b (diff) |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fileutils.rb | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/lib/fileutils.rb b/lib/fileutils.rb index de8474f2d0..a7fca26dbb 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -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 |