From: Pádraig Brady
Date: Mon, 23 Nov 2020 15:14:50 +0000 (+0000)
Subject: selinux-at, selinux-h: use const correct declarations
X-Git-Tag: v1.0~3472
X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=cb432e7d6144c99da594f1fbce8ec8fd939745a0;p=gnulib.git
selinux-at, selinux-h: use const correct declarations
* lib/se-selinux.in.h: Use const for "set" functions,
to match current selinux, and support cleaner user code.
* lib/selinux-at.c: Likewise.
* lib/selinux-at.h: Likewise.
---
diff --git a/ChangeLog b/ChangeLog
index 044b12d8c0..a17f2b208b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2020-11-23 Pádraig Brady
+
+ selinux-at, selinux-h: use const correct declarations
+ * lib/se-selinux.in.h: Use const for "set" functions,
+ to match current selinux, and support cleaner user code.
+ * lib/selinux-at.c: Likewise.
+ * lib/selinux-at.h: Likewise.
+
2020-11-22 Paul Eggert
canonicalize-lgpl: fix memory leak
diff --git a/lib/se-selinux.in.h b/lib/se-selinux.in.h
index a6c194aa0e..67d034d0f8 100644
--- a/lib/se-selinux.in.h
+++ b/lib/se-selinux.in.h
@@ -56,7 +56,7 @@ SE_SELINUX_INLINE int
getfscreatecon (char **con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
SE_SELINUX_INLINE int
-setfscreatecon (char *con _GL_UNUSED_PARAMETER)
+setfscreatecon (char const *con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
SE_SELINUX_INLINE int
matchpathcon (char const *file _GL_UNUSED_PARAMETER,
@@ -76,29 +76,29 @@ fgetfilecon (int fd, char **con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
SE_SELINUX_INLINE int
setfilecon (char const *file _GL_UNUSED_PARAMETER,
- char *con _GL_UNUSED_PARAMETER)
+ char const *con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
SE_SELINUX_INLINE int
lsetfilecon (char const *file _GL_UNUSED_PARAMETER,
- char *con _GL_UNUSED_PARAMETER)
+ char const *con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
SE_SELINUX_INLINE int
fsetfilecon (int fd _GL_UNUSED_PARAMETER,
- char *con _GL_UNUSED_PARAMETER)
+ char const *con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
SE_SELINUX_INLINE int
-security_check_context (char *con _GL_UNUSED_PARAMETER)
+security_check_context (char const *con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
SE_SELINUX_INLINE int
-security_check_context_raw (char *con _GL_UNUSED_PARAMETER)
+security_check_context_raw (char const *con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
SE_SELINUX_INLINE int
-setexeccon (char *con _GL_UNUSED_PARAMETER)
+setexeccon (char const *con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
SE_SELINUX_INLINE int
-security_compute_create (char *scon _GL_UNUSED_PARAMETER,
- char *tcon _GL_UNUSED_PARAMETER,
+security_compute_create (char const *scon _GL_UNUSED_PARAMETER,
+ char const *tcon _GL_UNUSED_PARAMETER,
security_class_t tclass _GL_UNUSED_PARAMETER,
char **newcon _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
diff --git a/lib/selinux-at.c b/lib/selinux-at.c
index 105a9f9d5c..e1d214c2a0 100644
--- a/lib/selinux-at.c
+++ b/lib/selinux-at.c
@@ -52,7 +52,7 @@
#define AT_FUNC_NAME setfileconat
#define AT_FUNC_F1 setfilecon
-#define AT_FUNC_POST_FILE_PARAM_DECLS , char *con
+#define AT_FUNC_POST_FILE_PARAM_DECLS , char const *con
#define AT_FUNC_POST_FILE_ARGS , con
#include "at-func.c"
#undef AT_FUNC_NAME
@@ -62,7 +62,7 @@
#define AT_FUNC_NAME lsetfileconat
#define AT_FUNC_F1 lsetfilecon
-#define AT_FUNC_POST_FILE_PARAM_DECLS , char *con
+#define AT_FUNC_POST_FILE_PARAM_DECLS , char const *con
#define AT_FUNC_POST_FILE_ARGS , con
#include "at-func.c"
#undef AT_FUNC_NAME
diff --git a/lib/selinux-at.h b/lib/selinux-at.h
index 50537f80f4..9b331cb182 100644
--- a/lib/selinux-at.h
+++ b/lib/selinux-at.h
@@ -42,11 +42,11 @@ int lgetfileconat (int dir_fd, char const *file, char **con);
the file specified by DIR_FD and FILE to CON. DIR_FD and FILE are
interpreted as for fstatat[*]. Upon success, return 0.
Otherwise, return -1 and set errno. */
-int setfileconat (int dir_fd, char const *file, char *con);
+int setfileconat (int dir_fd, char const *file, char const *con);
/* dir-fd-relative lsetfilecon. This function is just like setfileconat,
except that rather than dereferencing a symlink, this function affects it. */
/* dir-fd-relative lsetfilecon. This function is just like setfileconat,
except when DIR_FD and FILE specify a symlink: lsetfileconat operates on
the symlink, while setfileconat operates on the referent of the symlink. */
-int lsetfileconat (int dir_fd, char const *file, char *con);
+int lsetfileconat (int dir_fd, char const *file, char const *con);