From: Zac Medico Date: Wed, 22 Nov 2006 06:20:17 +0000 (-0000) Subject: Fix apply_permissions logic for cases where mode is unspecified. X-Git-Tag: v2.1.2~434 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=af7d3ca600800120a07941fe9805db603befa7e4;p=portage.git Fix apply_permissions logic for cases where mode is unspecified. svn path=/main/trunk/; revision=5115 --- diff --git a/pym/portage_util.py b/pym/portage_util.py index 4c7e3176f..1e7afe4b6 100644 --- a/pym/portage_util.py +++ b/pym/portage_util.py @@ -558,7 +558,10 @@ def apply_permissions(filename, uid=-1, gid=-1, mode=-1, mask=-1, # bits, so those bits are restored if necessary. if modified and new_mode == -1 and \ (st_mode & stat.S_ISUID or st_mode & stat.S_ISGID): - new_mode = mode & 07777 + if mode == -1: + new_mode = st_mode + elif mode & stat.S_ISUID or mode & stat.S_ISGID: + new_mode = mode & 07777 if not follow_links and stat.S_ISLNK(stat_cached.st_mode): # Mode doesn't matter for symlinks.