Merge "libselinux: android: allow dup *_context entries"
diff --git a/libselinux/src/label_backends_android.c b/libselinux/src/label_backends_android.c
index f85ec6f..eaca594 100644
--- a/libselinux/src/label_backends_android.c
+++ b/libselinux/src/label_backends_android.c
@@ -45,7 +45,9 @@
 }
 
 /*
- * Warn about duplicate specifications.
+ * Warn about duplicate specifications. Return error on different specifications.
+ * TODO: Remove duplicate specifications. Move duplicate check to after sort
+ * to improve performance.
  */
 static int nodups_specs(struct saved_data *data)
 {
@@ -58,10 +60,10 @@
 		for (jj = ii + 1; jj < data->nspec; jj++) {
 			if (!strcmp(spec_arr[jj].property_key,
 					    curr_spec->property_key)) {
-				rc = -1;
-				errno = EINVAL;
 				if (strcmp(spec_arr[jj].lr.ctx_raw,
 						    curr_spec->lr.ctx_raw)) {
+					rc = -1;
+					errno = EINVAL;
 					selinux_log
 						(SELINUX_ERROR,
 						 "Multiple different specifications for %s  (%s and %s).\n",
@@ -70,7 +72,7 @@
 						 curr_spec->lr.ctx_raw);
 				} else {
 					selinux_log
-						(SELINUX_ERROR,
+						(SELINUX_WARNING,
 						 "Multiple same specifications for %s.\n",
 						 curr_spec->property_key);
 				}