aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2014-03-26 13:45:46 -0500
committerJack Nagel2014-03-26 13:45:46 -0500
commite5fbc9c92ee103d4fbff80d8e77d46fde2497502 (patch)
treefd646a5898ba9b60c5bd4fb6a1cd66c131933c63
parent03fca453c444cc8c37caf50f9ae380b7f85509c8 (diff)
downloadbrew-e5fbc9c92ee103d4fbff80d8e77d46fde2497502.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