Fall back to Process.gid if we aren't a member of the file's group

This commit is contained in:
Jack Nagel 2014-03-26 13:45:46 -05:00
parent 03fca453c4
commit e5fbc9c92e

View File

@ -110,8 +110,11 @@ class Pathname
FileUtils.mv tf.path, self
uid = Process.uid
gid = Process.groups.delete(old_stat.gid) { Process.gid }
begin
chown(old_stat.uid, old_stat.gid)
chown(uid, gid)
chmod(old_stat.mode)
rescue Errno::EPERM
end