From owner-freebsd-current Fri Apr 17 14:12:46 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id OAA28510 for freebsd-current-outgoing; Fri, 17 Apr 1998 14:12:46 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from ifi.uio.no (0@ifi.uio.no [129.240.64.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id VAA28504 for ; Fri, 17 Apr 1998 21:12:40 GMT (envelope-from dag-erli@ifi.uio.no) Received: from hrotti.ifi.uio.no (2602@hrotti.ifi.uio.no [129.240.64.15]) by ifi.uio.no (8.8.8/8.8.7/ifi0.2) with ESMTP id XAA29081 for ; Fri, 17 Apr 1998 23:12:35 +0200 (MET DST) Received: (from dag-erli@localhost) by hrotti.ifi.uio.no ; Fri, 17 Apr 1998 23:12:34 +0200 (MET DST) Mime-Version: 1.0 To: current@FreeBSD.ORG Subject: kern/6184 Organization: Gutteklubben Terrasse / KRST / PUMS / YASMW X-url: http://www.stud.ifi.uio.no/~dag-erli/ X-Stop-Spam: http://www.cauce.org From: dag-erli@ifi.uio.no (Dag-Erling Coidan =?iso-8859-1?Q?Sm=F8rgrav?= ) Date: 17 Apr 1998 23:12:34 +0200 Message-ID: Lines: 65 X-Mailer: Gnus v5.5/Emacs 19.34 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I have a patch which I hope fixes kern/6184 (lseek allows seeks to negative offsets), but I don't want to commit it without having someone look at it first: Index: src/sys/kern/vfs_syscalls.c =================================================================== RCS file: /home/ncvs/src/sys/kern/vfs_syscalls.c,v retrieving revision 1.97 diff -u -r1.97 vfs_syscalls.c --- vfs_syscalls.c 1998/04/08 18:31:57 1.97 +++ vfs_syscalls.c 1998/04/17 21:03:13 @@ -1324,6 +1324,7 @@ register struct filedesc *fdp = p->p_fd; register struct file *fp; struct vattr vattr; + off_t ofs; int error; if ((u_int)SCARG(uap, fd) >= fdp->fd_nfiles || @@ -1333,21 +1334,22 @@ return (ESPIPE); switch (SCARG(uap, whence)) { case L_INCR: - fp->f_offset += SCARG(uap, offset); + ofs = fp->f_offset + SCARG(uap, offset); break; case L_XTND: error=VOP_GETATTR((struct vnode *)fp->f_data, &vattr, cred, p); if (error) return (error); - fp->f_offset = SCARG(uap, offset) + vattr.va_size; + ofs = SCARG(uap, offset) + vattr.va_size; break; case L_SET: - fp->f_offset = SCARG(uap, offset); + ofs = SCARG(uap, offset); break; default: return (EINVAL); } - *(off_t *)(p->p_retval) = fp->f_offset; + if (ofs < 0) return (EINVAL); + *(off_t *)(p->p_retval) = fp->f_offset = ofs; return (0); } Index: src/lib/libc/sys/lseek.2 =================================================================== RCS file: /home/ncvs/src/lib/libc/sys/lseek.2,v retrieving revision 1.6 diff -u -r1.6 lseek.2 --- lseek.2 1997/02/22 15:04:01 1.6 +++ lseek.2 1998/04/17 21:05:23 @@ -120,7 +120,7 @@ is associated with a pipe, socket, or FIFO. .It Bq Er EINVAL .Fa Whence -is not a proper value. +is not a proper value, or the resulting offset is negative. .El .Sh SEE ALSO .Xr dup 2 , -- Nobody else has a .sig like this one. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message