summaryrefslogtreecommitdiff
path: root/src/system.h
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2014-07-01 02:44:10 +0100
committerPádraig Brady <P@draigBrady.com>2014-07-01 15:45:53 +0100
commit8e764584fda9c153c1e1387b9f8fa2f2591c28ad (patch)
tree9382b0d74081b7b83171ef85dce5de65a32f7d29 /src/system.h
parent3106de5c789834cc9ee01fbc27b83b217e45e2ef (diff)
downloadcoreutils-8e764584fda9c153c1e1387b9f8fa2f2591c28ad.tar.xz
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.
Diffstat (limited to 'src/system.h')
-rw-r--r--src/system.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/system.h b/src/system.h
index f295ad1c2..162446c11 100644
--- a/src/system.h
+++ b/src/system.h
@@ -657,3 +657,9 @@ stzncpy (char *restrict dest, char const *restrict src, size_t len)
#ifndef ARRAY_CARDINALITY
# define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
#endif
+
+/* Avoid const warnings by casting to more portable type.
+ This is to cater for the incorrect const function declarations
+ in selinux.h before libselinux-2.3 (May 2014).
+ When version >= 2.3 is ubiquitous remove this function. */
+static inline char * se_const (char const * sctx) { return (char *) sctx; }