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/selinux.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/selinux.c') diff --git a/src/selinux.c b/src/selinux.c index 016db1626..ae454f8a3 100644 --- a/src/selinux.c +++ b/src/selinux.c @@ -72,10 +72,10 @@ mode_to_security_class (mode_t m) */ static int -computecon (char const *path, mode_t mode, security_context_t * con) +computecon (char const *path, mode_t mode, char **con) { - security_context_t scon = NULL; - security_context_t tcon = NULL; + char *scon = NULL; + char *tcon = NULL; security_class_t tclass; int rc = -1; @@ -111,7 +111,8 @@ int defaultcon (char const *path, mode_t mode) { int rc = -1; - security_context_t scon = NULL, tcon = NULL; + char *scon = NULL; + char *tcon = NULL; context_t scontext = 0, tcontext = 0; const char *contype; char *constr; @@ -182,7 +183,8 @@ restorecon_private (char const *path, bool local) { int rc = -1; struct stat sb; - security_context_t scon = NULL, tcon = NULL; + char *scon = NULL; + char *tcon = NULL; context_t scontext = 0, tcontext = 0; const char *contype; char *constr; -- cgit v1.2.3-54-g00ecf