summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libc/sys/lseek.22
-rw-r--r--sys/kern/vfs_extattr.c10
-rw-r--r--sys/kern/vfs_syscalls.c10
3 files changed, 9 insertions, 13 deletions
diff --git a/lib/libc/sys/lseek.2 b/lib/libc/sys/lseek.2
index 83fbb14..538ec11 100644
--- a/lib/libc/sys/lseek.2
+++ b/lib/libc/sys/lseek.2
@@ -120,7 +120,7 @@ is not an open file descriptor.
is associated with a pipe, socket, or FIFO.
.It Bq Er EINVAL
.Fa Whence
-is not a proper value, or the resulting offset is negative.
+is not a proper value.
.El
.Sh SEE ALSO
.Xr dup 2 ,
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c
index 1aacbb8..e96b515 100644
--- a/sys/kern/vfs_extattr.c
+++ b/sys/kern/vfs_extattr.c
@@ -1324,7 +1324,6 @@ lseek(p, uap)
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 ||
@@ -1334,22 +1333,21 @@ lseek(p, uap)
return (ESPIPE);
switch (SCARG(uap, whence)) {
case L_INCR:
- ofs = fp->f_offset + SCARG(uap, offset);
+ 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);
- ofs = SCARG(uap, offset) + vattr.va_size;
+ fp->f_offset = SCARG(uap, offset) + vattr.va_size;
break;
case L_SET:
- ofs = SCARG(uap, offset);
+ fp->f_offset = SCARG(uap, offset);
break;
default:
return (EINVAL);
}
- if (ofs < 0) return (EINVAL);
- *(off_t *)(p->p_retval) = fp->f_offset = ofs;
+ *(off_t *)(p->p_retval) = fp->f_offset;
return (0);
}
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 1aacbb8..e96b515 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1324,7 +1324,6 @@ lseek(p, uap)
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 ||
@@ -1334,22 +1333,21 @@ lseek(p, uap)
return (ESPIPE);
switch (SCARG(uap, whence)) {
case L_INCR:
- ofs = fp->f_offset + SCARG(uap, offset);
+ 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);
- ofs = SCARG(uap, offset) + vattr.va_size;
+ fp->f_offset = SCARG(uap, offset) + vattr.va_size;
break;
case L_SET:
- ofs = SCARG(uap, offset);
+ fp->f_offset = SCARG(uap, offset);
break;
default:
return (EINVAL);
}
- if (ofs < 0) return (EINVAL);
- *(off_t *)(p->p_retval) = fp->f_offset = ofs;
+ *(off_t *)(p->p_retval) = fp->f_offset;
return (0);
}
OpenPOWER on IntegriCloud