aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2014-03-26 13:45:46 -0500
committerJack Nagel2014-03-26 13:45:46 -0500
commitb7063f5d52cff5f3d748f8255992cceb05330d0c (patch)
treed37caf7d0a441b5bdffa059ed2e9ff3511137031
parent5bd6f27a6ed4ffd8ede749780f2d5a4cf796d485 (diff)
downloadhomebrew-b7063f5d52cff5f3d748f8255992cceb05330d0c.tar.bz2
Fall back to Process.gid if we aren't a member of the file's group
-rw-r--r--Library/Homebrew/extend/pathname.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb
index cb76c8910..c9c233144 100644
--- a/Library/Homebrew/extend/pathname.rb
+++ b/Library/Homebrew/extend/pathname.rb
@@ -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