diff mbox series

libselinux: warn on identical duplicate properties

Message ID 20250213022205.972878-1-tweek@google.com (mailing list archive)
State New
Headers show
Series libselinux: warn on identical duplicate properties | expand

Commit Message

ThiƩbaud Weksteen Feb. 13, 2025, 2:22 a.m. UTC
Instead of raising an error in case of matching duplicates, only report
the issue as a warning. This matches the downstream (AOSP) behaviour for
Android.

Signed-off-by: ThiƩbaud Weksteen <tweek@google.com>
---
 libselinux/src/label_backends_android.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/libselinux/src/label_backends_android.c b/libselinux/src/label_backends_android.c
index cbe932ae..cf4f5cbf 100644
--- a/libselinux/src/label_backends_android.c
+++ b/libselinux/src/label_backends_android.c
@@ -58,10 +58,10 @@  static int nodups_specs(struct saved_data *data, const char *path)
 		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,
 						 "%s: Multiple different specifications for %s  (%s and %s).\n",
@@ -70,7 +70,7 @@  static int nodups_specs(struct saved_data *data, const char *path)
 						 curr_spec->lr.ctx_raw);
 				} else {
 					selinux_log
-						(SELINUX_ERROR,
+						(SELINUX_WARNING,
 						 "%s: Multiple same specifications for %s.\n",
 						 path, curr_spec->property_key);
 				}