diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-11-22 06:40:59 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-11-22 06:40:59 +0000 |
commit | ee07681c1a57f4e3509c2b7a0519c15bd69781be (patch) | |
tree | d55850fb7b52184ac7d6413fd290d2e20f62307d | |
parent | de4a6cebf9fc6048a7ed4384608eb2c20f954e61 (diff) | |
download | portage-ee07681c1a57f4e3509c2b7a0519c15bd69781be.tar.gz portage-ee07681c1a57f4e3509c2b7a0519c15bd69781be.tar.bz2 portage-ee07681c1a57f4e3509c2b7a0519c15bd69781be.zip |
Really fix bit mask support when preserving S_ISUID and S_ISGID in apply_permissions.
svn path=/main/trunk/; revision=5117
-rw-r--r-- | pym/portage_util.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pym/portage_util.py b/pym/portage_util.py index 43d4fa8dd..baae9544e 100644 --- a/pym/portage_util.py +++ b/pym/portage_util.py @@ -560,13 +560,15 @@ def apply_permissions(filename, uid=-1, gid=-1, mode=-1, mask=-1, (st_mode & stat.S_ISUID or st_mode & stat.S_ISGID): if mode == -1: new_mode = st_mode - elif mode & stat.S_ISUID or mode & stat.S_ISGID: + else: mode = mode & 07777 if mask >= 0: new_mode = mode | st_mode new_mode = (mask ^ new_mode) & new_mode else: new_mode = mode + if not (new_mode & stat.S_ISUID or new_mode & stat.S_ISGID): + new_mode = -1 if not follow_links and stat.S_ISLNK(stat_cached.st_mode): # Mode doesn't matter for symlinks. |