From: Pádraig Brady Date: Mon, 23 Nov 2020 15:13:05 +0000 (+0000) Subject: maint: remove no longer needed se_const helper X-Git-Tag: v9.0~176 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e53bb7ad0555a41e2564103794df13afbf9e5269;p=thirdparty%2Fcoreutils.git maint: remove no longer needed se_const helper This was needed before libselinux-2.3 (May 2014), but modern releases have the correct const declarations. * src/chcon.c: Remove se_const() wrapper. * src/cp.c: Likewise. * src/install.c: Likewise. * src/mkdir.c: Likewise. * src/mkfifo.c: Likewise. * src/mknod.c: Likewise. * src/system.h: Likewise. * gnulib: update to pick up const correctness fixes in selinux stubs. --- diff --git a/gnulib b/gnulib index fdf0468198..cb432e7d61 160000 --- a/gnulib +++ b/gnulib @@ -1 +1 @@ -Subproject commit fdf0468198631a456406edc09983972edb8fa5c4 +Subproject commit cb432e7d6144c99da594f1fbce8ec8fd939745a0 diff --git a/src/chcon.c b/src/chcon.c index 724ec9b32f..7487133cd6 100644 --- a/src/chcon.c +++ b/src/chcon.c @@ -182,8 +182,8 @@ change_file_context (int fd, char const *file) if (file_context == NULL || ! STREQ (context_string, file_context)) { int fail = (affect_symlink_referent - ? setfileconat (fd, file, se_const (context_string)) - : lsetfileconat (fd, file, se_const (context_string))); + ? setfileconat (fd, file, context_string) + : lsetfileconat (fd, file, context_string)); if (fail) { @@ -559,7 +559,7 @@ main (int argc, char **argv) { specified_context = argv[optind++]; if (0 < is_selinux_enabled () - && security_check_context (se_const (specified_context)) < 0) + && security_check_context (specified_context) < 0) die (EXIT_FAILURE, errno, _("invalid context: %s"), quote (specified_context)); } diff --git a/src/cp.c b/src/cp.c index 3a451eb99e..d25afd53b6 100644 --- a/src/cp.c +++ b/src/cp.c @@ -1204,7 +1204,7 @@ main (int argc, char **argv) if (scontext && !restorecon (NULL, dst_path, 0)) error (...); */ - if (scontext && setfscreatecon (se_const (scontext)) < 0) + if (scontext && setfscreatecon (scontext) < 0) die (EXIT_FAILURE, errno, _("failed to set default file creation context to %s"), quote (scontext)); diff --git a/src/install.c b/src/install.c index dce29dbe1f..58484d63e8 100644 --- a/src/install.c +++ b/src/install.c @@ -921,7 +921,7 @@ main (int argc, char **argv) die (EXIT_FAILURE, 0, _("cannot set target context and preserve it")); - if (scontext && setfscreatecon (se_const (scontext)) < 0) + if (scontext && setfscreatecon (scontext) < 0) die (EXIT_FAILURE, errno, _("failed to set default file creation context to %s"), quote (scontext)); diff --git a/src/mkdir.c b/src/mkdir.c index 988e536246..8f07d666e5 100644 --- a/src/mkdir.c +++ b/src/mkdir.c @@ -269,7 +269,7 @@ main (int argc, char **argv) if (is_smack_enabled ()) ret = smack_set_label_for_self (scontext); else - ret = setfscreatecon (se_const (scontext)); + ret = setfscreatecon (scontext); if (ret < 0) die (EXIT_FAILURE, errno, diff --git a/src/mkfifo.c b/src/mkfifo.c index a28a9b84ae..b9ad5a8e1b 100644 --- a/src/mkfifo.c +++ b/src/mkfifo.c @@ -142,7 +142,7 @@ main (int argc, char **argv) if (is_smack_enabled ()) ret = smack_set_label_for_self (scontext); else - ret = setfscreatecon (se_const (scontext)); + ret = setfscreatecon (scontext); if (ret < 0) die (EXIT_FAILURE, errno, diff --git a/src/mknod.c b/src/mknod.c index 334a39769d..d19f1ae1ef 100644 --- a/src/mknod.c +++ b/src/mknod.c @@ -198,7 +198,7 @@ main (int argc, char **argv) if (is_smack_enabled ()) ret = smack_set_label_for_self (scontext); else - ret = setfscreatecon (se_const (scontext)); + ret = setfscreatecon (scontext); if (ret < 0) die (EXIT_FAILURE, errno, diff --git a/src/system.h b/src/system.h index ebf68349ab..d058ec6826 100644 --- a/src/system.h +++ b/src/system.h @@ -751,12 +751,6 @@ stzncpy (char *restrict dest, char const *restrict src, size_t len) # 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; } - /* Return true if ERR is ENOTSUP or EOPNOTSUPP, otherwise false. This wrapper function avoids the redundant 'or'd comparison on systems like Linux for which they have the same value. It also