summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2011-11-05 15:47:38 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2011-11-05 15:47:38 +0000
commit5633fe7bead0008d9d2e696526ab301c70f20ca0 (patch)
tree050af26442c9e8ef63c8c0bcb0d1cc41fed7574c /sys/kern
parent4e980851eda412ed097ed37ba3d34f94c8f3a8ca (diff)
ttys can't seek, so make pread/pwrite/preadv/pwritev fail with ESPIPE
on them too ok deraadt@, miod@
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/vfs_syscalls.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index bab1d742d6e..1455c18f62b 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_syscalls.c,v 1.178 2011/07/25 19:51:24 miod Exp $ */
+/* $OpenBSD: vfs_syscalls.c,v 1.179 2011/11/05 15:47:37 guenther Exp $ */
/* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */
/*
@@ -2876,7 +2876,8 @@ sys_pread(struct proc *p, void *v, register_t *retval)
return (EBADF);
vp = (struct vnode *)fp->f_data;
- if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO) {
+ if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO ||
+ (vp->v_flag & VISTTY)) {
return (ESPIPE);
}
@@ -2916,7 +2917,8 @@ sys_preadv(struct proc *p, void *v, register_t *retval)
return (EBADF);
vp = (struct vnode *)fp->f_data;
- if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO) {
+ if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO ||
+ (vp->v_flag & VISTTY)) {
return (ESPIPE);
}
@@ -2955,7 +2957,8 @@ sys_pwrite(struct proc *p, void *v, register_t *retval)
return (EBADF);
vp = (struct vnode *)fp->f_data;
- if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO) {
+ if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO ||
+ (vp->v_flag & VISTTY)) {
return (ESPIPE);
}
@@ -2995,7 +2998,8 @@ sys_pwritev(struct proc *p, void *v, register_t *retval)
return (EBADF);
vp = (struct vnode *)fp->f_data;
- if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO) {
+ if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO ||
+ (vp->v_flag & VISTTY)) {
return (ESPIPE);
}