libsepol/0018-libsepol-support-const-avtab_t-pointer-in-avtab_map.patch
Petr Lautrbach 1b0d1244a7 libsepol-3.4-4
Rebase on upstream f56a72ac9e86
2022-11-21 11:26:09 +01:00

53 lines
1.8 KiB
Diff

From d192e4d937c082ffe2519a18aa6086a3f6602cb0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
Date: Thu, 21 Jul 2022 17:24:41 +0200
Subject: [PATCH] libsepol: support const avtab_t pointer in avtab_map()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-type: text/plain
The access vector table itself is not modified in avtab_map() thus
support passing a const pointer.
Logically the content might be changed by the passed callback, but C
does not support transitive const-ness well, and C also does not support
function overloading, e.g. like for strchr(3).
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Acked-by: James Carter <jwcart2@gmail.com>
---
libsepol/include/sepol/policydb/avtab.h | 2 +-
libsepol/src/avtab.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libsepol/include/sepol/policydb/avtab.h b/libsepol/include/sepol/policydb/avtab.h
index 10ecde9aaf82..e4c48576177e 100644
--- a/libsepol/include/sepol/policydb/avtab.h
+++ b/libsepol/include/sepol/policydb/avtab.h
@@ -112,7 +112,7 @@ extern avtab_datum_t *avtab_search(avtab_t * h, avtab_key_t * k);
extern void avtab_destroy(avtab_t * h);
-extern int avtab_map(avtab_t * h,
+extern int avtab_map(const avtab_t * h,
int (*apply) (avtab_key_t * k,
avtab_datum_t * d, void *args), void *args);
diff --git a/libsepol/src/avtab.c b/libsepol/src/avtab.c
index 7920b60a3a43..82fec783e0c3 100644
--- a/libsepol/src/avtab.c
+++ b/libsepol/src/avtab.c
@@ -330,7 +330,7 @@ void avtab_destroy(avtab_t * h)
h->mask = 0;
}
-int avtab_map(avtab_t * h,
+int avtab_map(const avtab_t * h,
int (*apply) (avtab_key_t * k,
avtab_datum_t * d, void *args), void *args)
{
--
2.38.1