Commits

Anonymous committed 8c6e5f8

Revert "Call lsetfilecon directly in fixcon."

This reverts commit 0f3a5e88ddc12f033edd8f3bbe0457ff2d3146e4.

Comments (0)

Files changed (1)

 
 static int file_requires_fixup(const char *pathname,
 		struct selabel_handle *sehandle_old,
-		struct selabel_handle *sehandle_new,
-		char **context)
+		struct selabel_handle *sehandle_new)
 {
 	int ret;
 	struct stat sb;
 out:
 	if (current_context)
 		freecon(current_context);
+	if (new_context)
+		freecon(new_context);
 	if (old_context)
 		freecon(old_context);
-	if (new_context)
-		*context = new_context;
 	return ret;
 }
 
 		struct selabel_handle *sehandle_new)
 {
 	int requires_fixup;
-	char *new_context = NULL;
-
-	requires_fixup = file_requires_fixup(pathname, sehandle_old, sehandle_new, &new_context);
-
-	if (requires_fixup > 0)
-		lsetfilecon(pathname, new_context);
-
-	if (new_context)
-		freecon(new_context);
 
+	requires_fixup = file_requires_fixup(pathname, sehandle_old, sehandle_new);
 	if (requires_fixup < 0)
 		return -1;
 
+	if (requires_fixup)
+		selinux_android_restorecon(pathname);
+
 	return 0;
 }