diff options
author | Pádraig Brady <P@draigBrady.com> | 2014-07-01 02:44:10 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2014-07-01 15:45:53 +0100 |
commit | 8e764584fda9c153c1e1387b9f8fa2f2591c28ad (patch) | |
tree | 9382b0d74081b7b83171ef85dce5de65a32f7d29 /src/install.c | |
parent | 3106de5c789834cc9ee01fbc27b83b217e45e2ef (diff) | |
download | coreutils-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/install.c')
-rw-r--r-- | src/install.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/install.c b/src/install.c index e7de260c6..c3424227b 100644 --- a/src/install.c +++ b/src/install.c @@ -218,8 +218,8 @@ need_copy (const char *src_name, const char *dest_name, /* compare SELinux context if preserving */ if (selinux_enabled && x->preserve_security_context) { - security_context_t file_scontext = NULL; - security_context_t to_scontext = NULL; + char *file_scontext = NULL; + char *to_scontext = NULL; bool scontext_match; if (getfilecon (src_name, &file_scontext) == -1) @@ -312,7 +312,7 @@ static void setdefaultfilecon (char const *file) { struct stat st; - security_context_t scontext = NULL; + char *scontext = NULL; static bool first_call = true; if (selinux_enabled != 1) @@ -786,7 +786,7 @@ main (int argc, char **argv) int n_files; char **file; bool strip_program_specified = false; - security_context_t scontext = NULL; + char const *scontext = NULL; /* set iff kernel has extra selinux system calls */ selinux_enabled = (0 < is_selinux_enabled ()); @@ -943,7 +943,7 @@ main (int argc, char **argv) error (EXIT_FAILURE, 0, _("cannot set target context and preserve it")); - if (scontext && setfscreatecon (scontext) < 0) + if (scontext && setfscreatecon (se_const (scontext)) < 0) error (EXIT_FAILURE, errno, _("failed to set default file creation context to %s"), quote (scontext)); |