Anonymous committed 20f62f3

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

Change-Id: Id73796a70174333b61fd04ee6b1d99fccbea8116

Comments (0)

Files changed (1)

 int selinux_android_restorecon(const char *pathname)
+	if (is_selinux_enabled() <= 0)
+		return 0;
 	__selinux_once(fc_once, file_context_init);
 	int ret;