diff options
author | Matthew Dempsky <matthew@cvs.openbsd.org> | 2011-07-05 21:38:59 +0000 |
---|---|---|
committer | Matthew Dempsky <matthew@cvs.openbsd.org> | 2011-07-05 21:38:59 +0000 |
commit | 6ff4286249e49d5a8bb0c1d374248073d68668e5 (patch) | |
tree | 2953991ae2a90b997de04e935b1493bb38d872b1 /sys/kern | |
parent | a28c827b6cef7886430e3426e9f4a2d202681eae (diff) |
Don't worry about lseek(2)ing past the end of raw disk devices. The
disk drivers are now smart enough to handle this correctly, as they
need to also handle pread(2)/pwrite(2).
ok deraadt@, krw@; ok marco@ on an similar, earlier diff
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_syscalls.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 660c88bdad0..35555030b9e 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_syscalls.c,v 1.165 2010/10/28 15:02:41 millert Exp $ */ +/* $OpenBSD: vfs_syscalls.c,v 1.166 2011/07/05 21:38:58 matthew Exp $ */ /* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */ /* @@ -1389,7 +1389,7 @@ sys_lseek(struct proc *p, void *v, register_t *retval) switch (SCARG(uap, whence)) { case SEEK_CUR: - newoff = fp->f_offset + offarg;; + newoff = fp->f_offset + offarg; break; case SEEK_END: error = VOP_GETATTR((struct vnode *)fp->f_data, &vattr, @@ -1407,18 +1407,6 @@ sys_lseek(struct proc *p, void *v, register_t *retval) if (!special) { if (newoff < 0) return (EINVAL); - } else { - /* - * Make sure the user don't seek beyond the end of the - * partition. - */ - struct partinfo dpart; - error = vn_ioctl(fp, DIOCGPART, (void *)&dpart, p); - if (!error) { - if (newoff >= DL_GETPSIZE(dpart.part) * - dpart.disklab->d_secsize) - return (EINVAL); - } } *(off_t *)retval = fp->f_offset = newoff; fp->f_seek++; |