summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2011-11-05 15:47:37 +0000
committerguenther <guenther@openbsd.org>2011-11-05 15:47:37 +0000
commit8598e684571a2705a9ceee8db03d8d2c65182a14 (patch)
tree762d11de469c62dd05ccffb89ed2fb818eb92b30
parentVerify this fails with ESPIPE on ttys (diff)
downloadwireguard-openbsd-8598e684571a2705a9ceee8db03d8d2c65182a14.tar.xz
wireguard-openbsd-8598e684571a2705a9ceee8db03d8d2c65182a14.zip
ttys can't seek, so make pread/pwrite/preadv/pwritev fail with ESPIPE
on them too ok deraadt@, miod@
-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);
}