Cast file path to string.

Before passing a path into selinux.matchpathcon, it needs to be casted
to a string, since the path could be unicode and selinux.matchpathcon
does not support unicode.

Closes-Bug: #1260072
This commit is contained in:
James Slagle 2013-12-13 10:40:51 -05:00
parent cc04a21b7c
commit f5814193a2

View File

@ -170,6 +170,8 @@ class SeLinuxGuard(object):
def __exit__(self, excp_type, excp_value, excp_traceback):
if self.selinux and self.selinux.is_selinux_enabled():
path = os.path.realpath(os.path.expanduser(self.path))
# path should be a string, not unicode
path = str(path)
do_restore = False
try:
# See if even worth restoring??