Do not try to restorecon if selinux is disabled
debuggerd tries to restorecon on the tombstones directory which fails
when SELinux is not enabled in the kernel. That would return an error
condition to debuggerd which would then abort its attempt to dump the
stacks of the failing program.
Fix it here in case there are other places that might call this in the
future. Currently the only other caller is android_os_SELinux.cpp JNI
code.
Change-Id: Id73796a70174333b61fd04ee6b1d99fccbea8116
diff --git a/src/android.c b/src/android.c
index fb1b439..ed505a9 100644
--- a/src/android.c
+++ b/src/android.c
@@ -567,6 +567,9 @@
int selinux_android_restorecon(const char *pathname)
{
+ if (is_selinux_enabled() <= 0)
+ return 0;
+
__selinux_once(fc_once, file_context_init);
int ret;