diff options
author | bde <bde@FreeBSD.org> | 1996-12-19 19:42:37 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1996-12-19 19:42:37 +0000 |
commit | d8370232258e75a57361cafc2243862df35d18f1 (patch) | |
tree | cc194e09ac16ca08b2ba8a58498a24e9e4347dfa /sys/kern | |
parent | 30805cd75c006c0be5fa92042de94702692aa910 (diff) | |
download | FreeBSD-src-d8370232258e75a57361cafc2243862df35d18f1.zip FreeBSD-src-d8370232258e75a57361cafc2243862df35d18f1.tar.gz |
Fixed lseek() on named pipes. It always succeeded but should always fail.
Broke locking on named pipes in the same way as locking on non-vnodes
(wrong errno). This will be fixed later.
The fix involves negative logic. Named pipes are now distinguished from
other types of files with vnodes, and there is additional code to handle
vnodes and named pipes in the same way only where that makes sense (not
for lseek, locking or TIOCSCTTY).
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_descrip.c | 5 | ||||
-rw-r--r-- | sys/kern/vfs_extattr.c | 8 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 8 |
3 files changed, 12 insertions, 9 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index b7a3d50..9111d46 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94 - * $Id: kern_descrip.c,v 1.31 1996/08/15 16:33:32 smpatel Exp $ + * $Id: kern_descrip.c,v 1.32 1996/09/28 16:33:21 bde Exp $ */ #include <sys/param.h> @@ -417,6 +417,7 @@ ofstat(p, uap, retval) return (EBADF); switch (fp->f_type) { + case DTYPE_FIFO: case DTYPE_VNODE: error = vn_stat((struct vnode *)fp->f_data, &ub, p); break; @@ -468,6 +469,7 @@ fstat(p, uap, retval) return (EBADF); switch (fp->f_type) { + case DTYPE_FIFO: case DTYPE_VNODE: error = vn_stat((struct vnode *)fp->f_data, &ub, p); break; @@ -525,6 +527,7 @@ fpathconf(p, uap, retval) *retval = PIPE_BUF; return (0); + case DTYPE_FIFO: case DTYPE_VNODE: vp = (struct vnode *)fp->f_data; return (VOP_PATHCONF(vp, uap->name, retval)); diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index c4a4a7b..1337e95 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 - * $Id: vfs_syscalls.c,v 1.50 1996/09/03 14:21:53 bde Exp $ + * $Id: vfs_syscalls.c,v 1.51 1996/09/19 18:20:27 nate Exp $ */ /* @@ -698,9 +698,9 @@ open(p, uap, retval) } p->p_dupfd = 0; vp = nd.ni_vp; - + fp->f_flag = flags & FMASK; - fp->f_type = DTYPE_VNODE; + fp->f_type = (vp->v_type == VFIFO ? DTYPE_FIFO : DTYPE_VNODE); fp->f_ops = &vnops; fp->f_data = (caddr_t)vp; if (flags & (O_EXLOCK | O_SHLOCK)) { @@ -2346,7 +2346,7 @@ getvnode(fdp, fd, fpp) if ((u_int)fd >= fdp->fd_nfiles || (fp = fdp->fd_ofiles[fd]) == NULL) return (EBADF); - if (fp->f_type != DTYPE_VNODE) + if (fp->f_type != DTYPE_VNODE && fp->f_type != DTYPE_FIFO) return (EINVAL); *fpp = fp; return (0); diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index c4a4a7b..1337e95 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 - * $Id: vfs_syscalls.c,v 1.50 1996/09/03 14:21:53 bde Exp $ + * $Id: vfs_syscalls.c,v 1.51 1996/09/19 18:20:27 nate Exp $ */ /* @@ -698,9 +698,9 @@ open(p, uap, retval) } p->p_dupfd = 0; vp = nd.ni_vp; - + fp->f_flag = flags & FMASK; - fp->f_type = DTYPE_VNODE; + fp->f_type = (vp->v_type == VFIFO ? DTYPE_FIFO : DTYPE_VNODE); fp->f_ops = &vnops; fp->f_data = (caddr_t)vp; if (flags & (O_EXLOCK | O_SHLOCK)) { @@ -2346,7 +2346,7 @@ getvnode(fdp, fd, fpp) if ((u_int)fd >= fdp->fd_nfiles || (fp = fdp->fd_ofiles[fd]) == NULL) return (EBADF); - if (fp->f_type != DTYPE_VNODE) + if (fp->f_type != DTYPE_VNODE && fp->f_type != DTYPE_FIFO) return (EINVAL); *fpp = fp; return (0); |