Fixed 32bit error in lseek
authorKyle Milka <kmilka1995@gmail.com>
Fri, 15 Jul 2016 20:30:56 +0000 (13:30 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Fri, 15 Jul 2016 21:07:36 +0000 (17:07 -0400)
Lseek truncated the result when offset was a 64bit value.

Change-Id: I222afb0b5570a2dfac7a002593baaae322f9024a
Signed-off-by: Kyle Milka <kmilka@google.com>
[removed virtio-blk extras]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/src/syscall.c

index 64f6a17..2673eb5 100644 (file)
@@ -1869,10 +1869,8 @@ static intreg_t sys_llseek(struct proc *p, int fd, off_t offset_hi,
                ret = file->f_op->llseek(file, tempoff, &retoff, whence);
                kref_put(&file->f_kref);
        } else {
                ret = file->f_op->llseek(file, tempoff, &retoff, whence);
                kref_put(&file->f_kref);
        } else {
-               /* won't return here if error ... */
-               ret = sysseek(fd, tempoff, whence);
-               retoff = ret;
-               ret = 0;
+               retoff = sysseek(fd, tempoff, whence);
+               ret = (retoff < 0);
        }
 
        if (ret)
        }
 
        if (ret)