]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: remove no longer needed se_const helper
authorPádraig Brady <P@draigBrady.com>
Mon, 23 Nov 2020 15:13:05 +0000 (15:13 +0000)
committerPádraig Brady <P@draigBrady.com>
Mon, 23 Nov 2020 22:25:55 +0000 (22:25 +0000)
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.

gnulib
src/chcon.c
src/cp.c
src/install.c
src/mkdir.c
src/mkfifo.c
src/mknod.c
src/system.h

diff --git a/gnulib b/gnulib
index fdf0468198631a456406edc09983972edb8fa5c4..cb432e7d6144c99da594f1fbce8ec8fd939745a0 160000 (submodule)
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit fdf0468198631a456406edc09983972edb8fa5c4
+Subproject commit cb432e7d6144c99da594f1fbce8ec8fd939745a0
index 724ec9b32f77bb7e66b7f83a8bc9c62f414ba792..7487133cd6b073532c498e74a8edf49ec11cb657 100644 (file)
@@ -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));
     }
index 3a451eb99e31ca06e9f35daa67b25c14526ca8aa..d25afd53b61d0c7c94a40de5b60da6148ee784b7 100644 (file)
--- 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));
index dce29dbe1f8f86c29c4c402f70f1e62a0b5abf6f..58484d63e8882384083927557334976210dd1ee3 100644 (file)
@@ -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));
index 988e536246b216c7c2ad79e7a197ba5f6b7a9d92..8f07d666e501edba3b7e74841cbf276fcc6f4501 100644 (file)
@@ -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,
index a28a9b84ae0994584b66dd7c62638741f5e782e0..b9ad5a8e1b43b4119e790e918e3c80f09b0d0698 100644 (file)
@@ -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,
index 334a39769df15d47334a5650e59f951ff7aa81fd..d19f1ae1ef47f0b0305b3d98d19cdf21a06ba6db 100644 (file)
@@ -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,
index ebf68349ab17c77248f6107fd0deb27589b8c478..d058ec682632aede7f4404ff35a39dbfa29907ac 100644 (file)
@@ -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