mirror of
https://github.com/topjohnwu/selinux.git
synced 2025-02-20 11:21:25 +00:00
libselinux: Fix const-correctness
* include/selinux/selinux.h, src/init.c: set_selinuxmnt should take a const char *mntpath * src/get_default_type.c: Avoid bad cast discarding const * load_policy.c: Fix var decl to avoid discarding const Signed-off-by: Eric Paris <eparis@redhat.com> Acked-by: Dan Walsh <dwalsh@redhat.com>
This commit is contained in:
parent
86795159d4
commit
b82b7e02df
@ -537,7 +537,7 @@ extern int selinux_check_securetty_context(const security_context_t tty_context)
|
||||
Normally, this is determined automatically during libselinux
|
||||
initialization, but this is not always possible, e.g. for /sbin/init
|
||||
which performs the initial mount of selinuxfs. */
|
||||
void set_selinuxmnt(char *mnt);
|
||||
void set_selinuxmnt(const char *mnt);
|
||||
|
||||
/* Check if selinuxfs exists as a kernel filesystem */
|
||||
int selinuxfs_exists(void);
|
||||
|
@ -27,7 +27,8 @@ int get_default_type(const char *role, char **type)
|
||||
static int find_default_type(FILE * fp, const char *role, char **type)
|
||||
{
|
||||
char buf[250];
|
||||
char *ptr = "", *end, *t;
|
||||
const char *ptr = "", *end;
|
||||
char *t;
|
||||
size_t len;
|
||||
int found = 0;
|
||||
|
||||
|
@ -28,7 +28,7 @@ int obj_class_compat = 1;
|
||||
* The file system is read/write
|
||||
* then set this as the default file system.
|
||||
*/
|
||||
static int verify_selinuxmnt(char *mnt)
|
||||
static int verify_selinuxmnt(const char *mnt)
|
||||
{
|
||||
struct statfs sfbuf;
|
||||
int rc;
|
||||
@ -139,7 +139,7 @@ void fini_selinuxmnt(void)
|
||||
|
||||
hidden_def(fini_selinuxmnt)
|
||||
|
||||
void set_selinuxmnt(char *mnt)
|
||||
void set_selinuxmnt(const char *mnt)
|
||||
{
|
||||
selinux_mnt = strdup(mnt);
|
||||
}
|
||||
|
@ -369,7 +369,7 @@ int selinux_init_load_policy(int *enforce)
|
||||
* Check for the existence of SELinux via selinuxfs, and
|
||||
* mount it if present for use in the calls below.
|
||||
*/
|
||||
char *mntpoint = NULL;
|
||||
const char *mntpoint = NULL;
|
||||
if (mount(SELINUXFS, SELINUXMNT, SELINUXFS, 0, 0) == 0 || errno == EBUSY) {
|
||||
mntpoint = SELINUXMNT;
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user