diff options
author | ed <ed@FreeBSD.org> | 2012-02-10 12:35:57 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2012-02-10 12:35:57 +0000 |
commit | 28b4a002d6c95bc9e26ea30871aa91c1cc4b3563 (patch) | |
tree | 38fefd1e5bde255db2d3eab529d481ce373dec71 /sys/security/mac_mls/mac_mls.c | |
parent | 7bf1094d6b76324d8ab7decb5dc0d06999a72842 (diff) | |
download | FreeBSD-src-28b4a002d6c95bc9e26ea30871aa91c1cc4b3563.zip FreeBSD-src-28b4a002d6c95bc9e26ea30871aa91c1cc4b3563.tar.gz |
Remove direct access to si_name.
Code should just use the devtoname() function to obtain the name of a
character device. Also add const keywords to pieces of code that need it
to build properly.
MFC after: 2 weeks
Diffstat (limited to 'sys/security/mac_mls/mac_mls.c')
-rw-r--r-- | sys/security/mac_mls/mac_mls.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/sys/security/mac_mls/mac_mls.c b/sys/security/mac_mls/mac_mls.c index 8019469..8ffa76b 100644 --- a/sys/security/mac_mls/mac_mls.c +++ b/sys/security/mac_mls/mac_mls.c @@ -908,21 +908,23 @@ mls_devfs_create_device(struct ucred *cred, struct mount *mp, struct cdev *dev, struct devfs_dirent *de, struct label *delabel) { struct mac_mls *mm; + const char *dn; int mls_type; mm = SLOT(delabel); - if (strcmp(dev->si_name, "null") == 0 || - strcmp(dev->si_name, "zero") == 0 || - strcmp(dev->si_name, "random") == 0 || - strncmp(dev->si_name, "fd/", strlen("fd/")) == 0) + dn = devtoname(dev); + if (strcmp(dn, "null") == 0 || + strcmp(dn, "zero") == 0 || + strcmp(dn, "random") == 0 || + strncmp(dn, "fd/", strlen("fd/")) == 0) mls_type = MAC_MLS_TYPE_EQUAL; - else if (strcmp(dev->si_name, "kmem") == 0 || - strcmp(dev->si_name, "mem") == 0) + else if (strcmp(dn, "kmem") == 0 || + strcmp(dn, "mem") == 0) mls_type = MAC_MLS_TYPE_HIGH; else if (ptys_equal && - (strncmp(dev->si_name, "ttyp", strlen("ttyp")) == 0 || - strncmp(dev->si_name, "pts/", strlen("pts/")) == 0 || - strncmp(dev->si_name, "ptyp", strlen("ptyp")) == 0)) + (strncmp(dn, "ttyp", strlen("ttyp")) == 0 || + strncmp(dn, "pts/", strlen("pts/")) == 0 || + strncmp(dn, "ptyp", strlen("ptyp")) == 0)) mls_type = MAC_MLS_TYPE_EQUAL; else mls_type = MAC_MLS_TYPE_LOW; |