[PATCH 5/5] libselinux: constify selinux_set_mapping(3) parameter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>

The map parameter of selinux_set_mapping(3) is only read from and not
modified, thus declare it const.

Signed-off-by: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>
---
 libselinux/include/selinux/selinux.h      | 2 +-
 libselinux/man/man3/selinux_set_mapping.3 | 2 +-
 libselinux/src/mapping.c                  | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libselinux/include/selinux/selinux.h b/libselinux/include/selinux/selinux.h
index 83ea871c..61c1422b 100644
--- a/libselinux/include/selinux/selinux.h
+++ b/libselinux/include/selinux/selinux.h
@@ -413,7 +413,7 @@ struct security_class_mapping {
  * starting at 1, and have one security_class_mapping structure entry
  * per define.
  */
-extern int selinux_set_mapping(struct security_class_mapping *map);
+extern int selinux_set_mapping(const struct security_class_mapping *map);
 
 /* Common helpers */
 
diff --git a/libselinux/man/man3/selinux_set_mapping.3 b/libselinux/man/man3/selinux_set_mapping.3
index a1f82e5a..bb48eb43 100644
--- a/libselinux/man/man3/selinux_set_mapping.3
+++ b/libselinux/man/man3/selinux_set_mapping.3
@@ -15,7 +15,7 @@ struct security_class_mapping {
 };
 .fi
 .sp
-.BI "int selinux_set_mapping(struct security_class_mapping *" map ");"
+.BI "int selinux_set_mapping(const struct security_class_mapping *" map ");"
 .
 .SH "DESCRIPTION"
 .BR selinux_set_mapping ()
diff --git a/libselinux/src/mapping.c b/libselinux/src/mapping.c
index dd2f1039..d863e449 100644
--- a/libselinux/src/mapping.c
+++ b/libselinux/src/mapping.c
@@ -31,7 +31,7 @@ static security_class_t current_mapping_size = 0;
  */
 
 int
-selinux_set_mapping(struct security_class_mapping *map)
+selinux_set_mapping(const struct security_class_mapping *map)
 {
 	size_t size = sizeof(struct selinux_mapping);
 	security_class_t i, j;
@@ -64,7 +64,7 @@ selinux_set_mapping(struct security_class_mapping *map)
 	/* Store the raw class and permission values */
 	j = 0;
 	while (map[j].name) {
-		struct security_class_mapping *p_in = map + (j++);
+		const struct security_class_mapping *p_in = map + (j++);
 		struct selinux_mapping *p_out = current_mapping + j;
 
 		p_out->value = string_to_security_class(p_in->name);
-- 
2.43.0





[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux