From ab4a5982c195e611a03a9f970cae27d9fa78acae Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 2 Apr 2025 15:32:15 +0200 Subject: [PATCH] selinux-util: rename return parameter to ret_xyz mac_selinux_get_create_label_from_exe() didn't get this right. Clean this up, and stick to a uniform name for all three related functions. --- src/shared/selinux-util.c | 12 ++++++------ src/shared/selinux-util.h | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/shared/selinux-util.c b/src/shared/selinux-util.c index 27ed339ff89..243413bdf78 100644 --- a/src/shared/selinux-util.c +++ b/src/shared/selinux-util.c @@ -407,14 +407,14 @@ int mac_selinux_apply_fd(int fd, const char *path, const char *label) { return 0; } -int mac_selinux_get_create_label_from_exe(const char *exe, char **label) { +int mac_selinux_get_create_label_from_exe(const char *exe, char **ret_label) { #if HAVE_SELINUX _cleanup_freecon_ char *mycon = NULL, *fcon = NULL; security_class_t sclass; int r; assert(exe); - assert(label); + assert(ret_label); r = selinux_init(/* force= */ false); if (r < 0) @@ -436,14 +436,14 @@ int mac_selinux_get_create_label_from_exe(const char *exe, char **label) { if (sclass == 0) return -ENOSYS; - return RET_NERRNO(security_compute_create_raw(mycon, fcon, sclass, label)); + return RET_NERRNO(security_compute_create_raw(mycon, fcon, sclass, ret_label)); #else return -EOPNOTSUPP; #endif } -int mac_selinux_get_our_label(char **ret) { - assert(ret); +int mac_selinux_get_our_label(char **ret_label) { + assert(ret_label); #if HAVE_SELINUX int r; @@ -460,7 +460,7 @@ int mac_selinux_get_our_label(char **ret) { if (!con) return -EOPNOTSUPP; - *ret = TAKE_PTR(con); + *ret_label = TAKE_PTR(con); return 0; #else return -EOPNOTSUPP; diff --git a/src/shared/selinux-util.h b/src/shared/selinux-util.h index 3a2cf0d8507..12627f94ecf 100644 --- a/src/shared/selinux-util.h +++ b/src/shared/selinux-util.h @@ -35,9 +35,9 @@ int mac_selinux_fix_full(int atfd, const char *inode_path, const char *label_pat int mac_selinux_apply(const char *path, const char *label); int mac_selinux_apply_fd(int fd, const char *path, const char *label); -int mac_selinux_get_create_label_from_exe(const char *exe, char **label); -int mac_selinux_get_our_label(char **label); -int mac_selinux_get_child_mls_label(int socket_fd, const char *exe, const char *exec_label, char **label); +int mac_selinux_get_create_label_from_exe(const char *exe, char **ret_label); +int mac_selinux_get_our_label(char **ret_label); +int mac_selinux_get_child_mls_label(int socket_fd, const char *exe, const char *exec_label, char **ret_label); int mac_selinux_create_file_prepare_at(int dirfd, const char *path, mode_t mode); static inline int mac_selinux_create_file_prepare(const char *path, mode_t mode) { -- 2.47.3