summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-11-22 06:33:31 +0000
committerZac Medico <zmedico@gentoo.org>2006-11-22 06:33:31 +0000
commitde4a6cebf9fc6048a7ed4384608eb2c20f954e61 (patch)
treedb71346538a83da792850ea25612b9a8200cd682
parentaf7d3ca600800120a07941fe9805db603befa7e4 (diff)
downloadportage-de4a6cebf9fc6048a7ed4384608eb2c20f954e61.tar.gz
portage-de4a6cebf9fc6048a7ed4384608eb2c20f954e61.tar.bz2
portage-de4a6cebf9fc6048a7ed4384608eb2c20f954e61.zip
Fix bit mask support when preserving S_ISUID and S_ISGID in apply_permissions.
svn path=/main/trunk/; revision=5116
-rw-r--r--pym/portage_util.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/pym/portage_util.py b/pym/portage_util.py
index 1e7afe4b6..43d4fa8dd 100644
--- a/pym/portage_util.py
+++ b/pym/portage_util.py
@@ -561,7 +561,12 @@ def apply_permissions(filename, uid=-1, gid=-1, mode=-1, mask=-1,
if mode == -1:
new_mode = st_mode
elif mode & stat.S_ISUID or mode & stat.S_ISGID:
- new_mode = mode & 07777
+ mode = mode & 07777
+ if mask >= 0:
+ new_mode = mode | st_mode
+ new_mode = (mask ^ new_mode) & new_mode
+ else:
+ new_mode = mode
if not follow_links and stat.S_ISLNK(stat_cached.st_mode):
# Mode doesn't matter for symlinks.