Date: Sun, 12 Nov 1995 12:43:37 -0800 From: "Amancio Hasty Jr." <hasty@rah.star-gate.com> To: hackers@FreeBSD.ORG Subject: linux's lseek vs freebsd's lseek Message-ID: <199511122043.MAA01434@rah.star-gate.com>
next in thread | raw e-mail | index | archive | help
Howdy,
While in the process of getting Linux's music server for Doom (musserver)
working, I discovered that on linux you can issue a seek with a negative
offset. So I changed the addition of an offset to a file position to
be a of type "int".
In vfs_syscalls.c,
lseek(p, uap, retval)
struct proc *p;
register struct lseek_args *uap;
int *retval;
{
struct ucred *cred = p->p_ucred;
register struct filedesc *fdp = p->p_fd;
register struct file *fp;
struct vattr vattr;
int error;
if ((u_int)uap->fd >= fdp->fd_nfiles ||
(fp = fdp->fd_ofiles[uap->fd]) == NULL)
return (EBADF);
if (fp->f_type != DTYPE_VNODE)
return (ESPIPE);
switch (uap->whence) {
case L_INCR:
(int)fp->f_offset += (int)uap->offset;
^^^^ ^^^^
---------------
The question is what is the implication of doing a signed addition as
supposed to an unsigned addition as it is in the original file.
Tnks,
Amancio
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199511122043.MAA01434>
