Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 525726
Collapse All | Expand All

(-)a/pym/portage/_selinux.py (-1 / +14 lines)
Lines 77-83 def settype(newtype): Link Here
77
77
78
def setexec(ctx="\n"):
78
def setexec(ctx="\n"):
79
	ctx = _native_string(ctx, encoding=_encodings['content'], errors='strict')
79
	ctx = _native_string(ctx, encoding=_encodings['content'], errors='strict')
80
	if selinux.setexeccon(ctx) < 0:
80
	rc = 0
81
	try:
82
		rc = selinux.setexeccon(ctx)
83
	except:
84
		if selinux.security_getenforce() == 1:
85
			raise OSError(_("Failed to set new SELinux execution context. " + \
86
				"Is your current SELinux context allowed to run Portage?\n"))
87
		else:
88
			portage.writemsg("!!! " + \
89
				_("Failed to set new SELinux execution context. " + \
90
				"Is your current SELinux context allowed to run Portage?\n"), \
91
				noiselevel=-1)
92
93
	if rc < 0:
81
		if sys.hexversion < 0x3000000:
94
		if sys.hexversion < 0x3000000:
82
			ctx = _unicode_decode(ctx, encoding=_encodings['content'], errors='replace')
95
			ctx = _unicode_decode(ctx, encoding=_encodings['content'], errors='replace')
83
		if selinux.security_getenforce() == 1:
96
		if selinux.security_getenforce() == 1:

Return to bug 525726