* 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. --- ChangeLog | 8 ++++++++ lib/se-selinux.in.h | 18 +++++++++--------- lib/selinux-at.c | 4 ++-- lib/selinux-at.h | 4 ++-- 4 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog index 044b12d8c..a17f2b208 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2020-11-23 Pádraig Brady <p...@draigbrady.com> + + 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 <egg...@cs.ucla.edu> canonicalize-lgpl: fix memory leak diff --git a/lib/se-selinux.in.h b/lib/se-selinux.in.h index a6c194aa0..67d034d0f 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 105a9f9d5..e1d214c2a 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 50537f80f..9b331cb18 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); -- 2.26.2