Declare smack_mnt as non-static in init.c.
authorJarkko Sakkinen <jarkko.sakkinen@iki.fi>
Thu, 8 Nov 2012 07:33:19 +0000 (09:33 +0200)
committerJarkko Sakkinen <jarkko.sakkinen@iki.fi>
Thu, 8 Nov 2012 07:37:10 +0000 (09:37 +0200)
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 <jarkko.sakkinen@iki.fi>
libsmack/init.c
libsmack/libsmack.c

index d12f445..44e3e9c 100644 (file)
@@ -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);
index 3d034da..df763a8 100644 (file)
@@ -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;