diff options
author | phk <phk@FreeBSD.org> | 2000-08-21 14:45:19 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2000-08-21 14:45:19 +0000 |
commit | 323f259948adbb0e60f71f112257654ba4bedbd2 (patch) | |
tree | 9ddc4c9212686ee51cc2bcf0724d65ae887654d6 | |
parent | c907983705bdf33a0ce8f37d15b204e0702dfe41 (diff) | |
download | FreeBSD-src-323f259948adbb0e60f71f112257654ba4bedbd2.zip FreeBSD-src-323f259948adbb0e60f71f112257654ba4bedbd2.tar.gz |
Fix devfs_access() bug on directories.
Remove unused #includes.
Bug spotted by: markm
-rw-r--r-- | sys/fs/devfs/devfs_devs.c | 3 | ||||
-rw-r--r-- | sys/fs/devfs/devfs_vfsops.c | 2 | ||||
-rw-r--r-- | sys/fs/devfs/devfs_vnops.c | 16 |
3 files changed, 8 insertions, 13 deletions
diff --git a/sys/fs/devfs/devfs_devs.c b/sys/fs/devfs/devfs_devs.c index 4bcfc03..10be9da 100644 --- a/sys/fs/devfs/devfs_devs.c +++ b/sys/fs/devfs/devfs_devs.c @@ -31,12 +31,9 @@ #include <sys/param.h> #include <sys/systm.h> -#include <sys/kernel.h> #include <sys/dirent.h> #include <sys/conf.h> -#include <sys/proc.h> #include <sys/vnode.h> -#include <sys/mount.h> #include <sys/malloc.h> #include <sys/eventhandler.h> #include <sys/ctype.h> diff --git a/sys/fs/devfs/devfs_vfsops.c b/sys/fs/devfs/devfs_vfsops.c index 2cd7611..27b1fd7 100644 --- a/sys/fs/devfs/devfs_vfsops.c +++ b/sys/fs/devfs/devfs_vfsops.c @@ -37,8 +37,6 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> -#include <sys/dirent.h> -#include <sys/conf.h> #include <sys/proc.h> #include <sys/vnode.h> #include <sys/mount.h> diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index fb14abf..496eba5 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -38,7 +38,6 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> -#include <sys/vmmeter.h> #include <sys/time.h> #include <sys/conf.h> #include <sys/vnode.h> @@ -48,7 +47,6 @@ #include <sys/mount.h> #include <sys/namei.h> #include <sys/dirent.h> -#include <sys/resource.h> #include <sys/eventhandler.h> #define DEVFS_INTERN @@ -222,13 +220,15 @@ devfs_access(ap) } */ *ap; { struct vnode *vp = ap->a_vp; - mode_t amode = ap->a_mode; - struct devfs_dirent *de = vp->v_data; - mode_t fmode = de->de_mode; + struct devfs_dirent *de; + struct devfs_dir *dd; - /* Some files are simply not modifiable. */ - if ((amode & VWRITE) && (fmode & (S_IWUSR|S_IWGRP|S_IWOTH)) == 0) - return (EPERM); + if (vp->v_type == VDIR) { + dd = vp->v_data; + de = TAILQ_FIRST(&dd->dd_list); + } else { + de = vp->v_data; + } return (vaccess(vp->v_type, de->de_mode, de->de_uid, de->de_gid, ap->a_mode, ap->a_cred)); |