From fd33715c1c3ca8904e3ab4b00520f3cc3657f146 Mon Sep 17 00:00:00 2001 From: Jarkko Sakkinen Date: Thu, 8 Nov 2012 09:33:19 +0200 Subject: [PATCH] Declare smack_mnt as non-static in init.c. Use it directly in libsmack.c. It will be declared as local symbol in DSO because we declare visible symbols explicitly in libsmack.sym. Signed-off-by: Jarkko Sakkinen --- libsmack/init.c | 7 +------ libsmack/libsmack.c | 11 +++++++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/libsmack/init.c b/libsmack/init.c index d12f445..44e3e9c 100644 --- a/libsmack/init.c +++ b/libsmack/init.c @@ -48,7 +48,7 @@ #define SMACKFSMNT "/sys/fs/smackfs/" #define OLDSMACKFSMNT "/smack" -static char *smack_mnt = NULL; +char *smack_mnt = NULL; void set_smackmnt(const char *mnt) { @@ -175,11 +175,6 @@ static void init_smackmnt(void) return; } -const char *smack_smackfs_path(void) -{ - return smack_mnt; -} - void fini_smackmnt(void) { free(smack_mnt); diff --git a/libsmack/libsmack.c b/libsmack/libsmack.c index 3d034da..df763a8 100644 --- a/libsmack/libsmack.c +++ b/libsmack/libsmack.c @@ -60,7 +60,7 @@ #define READ_BUF_SIZE LOAD_LEN + 1 #define SELF_LABEL_FILE "/proc/self/attr/current" -const char *smack_mnt; +extern char *smack_mnt; struct smack_rule { char subject[LABEL_LEN + 1]; @@ -247,7 +247,6 @@ int smack_have_access(const char *subject, const char *object, int access2 = 1; char path[PATH_MAX]; - smack_mnt = smack_smackfs_path(); if (!smack_mnt) { errno = EFAULT; return -1; @@ -402,6 +401,11 @@ err_out: return NULL; } +const char *smack_smackfs_path(void) +{ + return smack_mnt; +} + int smack_cipso_apply(struct smack_cipso *cipso) { struct cipso_mapping *m = NULL; @@ -410,7 +414,6 @@ int smack_cipso_apply(struct smack_cipso *cipso) int i; char path[PATH_MAX]; - smack_mnt = smack_smackfs_path(); if (!smack_mnt) { errno = EFAULT; return -1; @@ -438,6 +441,7 @@ int smack_cipso_apply(struct smack_cipso *cipso) close(fd); return 0; } + int smack_new_label_from_self(char **label) { char *result; @@ -500,7 +504,6 @@ static int accesses_apply(struct smack_accesses *handle, int clear) int load2 = 1; char path[PATH_MAX]; - smack_mnt = smack_smackfs_path(); if (!smack_mnt) { errno = EFAULT; return -1; -- 2.7.4