It's already possible to lseek(2) to the last sector of the disk and
then read(2) that sector, leaving f_offset pointing at EOF, so there's
no point in preventing lseek(2) from jumping there directly.
ok?
Index: kern/vfs_syscalls.c
===================================================================
RCS file: /home/mdempsky/anoncvs/cvs/src/sys/kern/vfs_syscalls.c,v
retrieving revision 1.165
diff -u -p -r1.165 vfs_syscalls.c
--- kern/vfs_syscalls.c 28 Oct 2010 15:02:41 -0000 1.165
+++ kern/vfs_syscalls.c 5 Jul 2011 07:09:29 -0000
@@ -1389,7 +1389,7 @@ sys_lseek(struct proc *p, void *v, regis
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,
@@ -1415,9 +1415,9 @@ sys_lseek(struct proc *p, void *v, regis
struct partinfo dpart;
error = vn_ioctl(fp, DIOCGPART, (void *)&dpart, p);
if (!error) {
- if (newoff >= DL_GETPSIZE(dpart.part) *
+ if (newoff > DL_GETPSIZE(dpart.part) *
dpart.disklab->d_secsize)
- return (EINVAL);
+ return (EINVAL);
}
}
*(off_t *)retval = fp->f_offset = newoff;