[PATCH 2/2] Catch failures to set selinux contexts so it doesn't cause a crash.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 isys/isys.py |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/isys/isys.py b/isys/isys.py
index 14d2a5d..9341c6b 100755
--- a/isys/isys.py
+++ b/isys/isys.py
@@ -612,9 +612,13 @@ def matchPathContext(fn):
 # @param instroot An optional root filesystem to look under for fn.
 def setFileContext(fn, con, instroot = '/'):
     full_path = os.path.normpath("%s/%s" % (instroot, fn))
+    rc = False
     if con is not None and os.access(full_path, os.F_OK):
-        return (selinux.lsetfilecon(full_path, con) != 0)
-    return False
+        try:
+            rc = (selinux.lsetfilecon(full_path, con) == 0)
+        except OSError:
+            log.info("failed to set SELinux context for %s" % full_path)
+    return rc
 
 ## Restore the SELinux file context of a file to its default.
 # @param fn The filename to fix.
-- 
1.6.2.5

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux