From 8e764584fda9c153c1e1387b9f8fa2f2591c28ad Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Tue, 1 Jul 2014 02:44:10 +0100 Subject: maint: fix const correctness warnings with security_context_t The security_context_t type was always an artificial separation from a standard char* string, and various libselinux using code assumed both were synonymous. In addition, prior to libselinux 2.3 function declarations were incorrect wrt constness of this type. Here we replace security_context_t with char*, and also provide a wrapper function to cater for the const issue on older libselinux. * src/system.h (se_const): A new function to avoid and identify the const issue on older libselinux. * src/copy.c: s/security_context_t/char */. * src/cp.c: Likewise. * src/id.c: Likewise. * src/install.c: Likewise. * src/ls.c: Likewise. * src/mkdir.c: Likewise. * src/mkfifo.c: Likewise. * src/mknod.c: Likewise. * src/runcon.c: Likewise. * src/selinux.c: Likewise. * tests/cp/no-ctx.sh: Likewise. * src/chcon.c: Likesize. --- src/id.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/id.c') diff --git a/src/id.c b/src/id.c index f46bb41b5..ccd1e879a 100644 --- a/src/id.c +++ b/src/id.c @@ -58,7 +58,7 @@ static bool ok = true; /* The SELinux context. Start with a known invalid value so print_full_info knows when 'context' has not been set to a meaningful value. */ -static security_context_t context = NULL; +static char *context = NULL; static struct option const longopts[] = { @@ -220,7 +220,7 @@ main (int argc, char **argv) /* Report failure only if --context (-Z) was explicitly requested. */ if ((selinux_enabled && getcon (&context) && just_context) || (smack_enabled - && smack_new_label_from_self ((char **) &context) < 0 + && smack_new_label_from_self (&context) < 0 && just_context)) error (EXIT_FAILURE, 0, _("can't get process context")); } -- cgit v1.2.3-54-g00ecf