Lseek truncated the result when offset was a 64bit value.

Change-Id: I222afb0b5570a2dfac7a002593baaae322f9024a
Signed-off-by: Kyle Milka <[email protected]>
---
 kern/src/syscall.c    | 6 ++----
 user/vmm/virtio_blk.c | 2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/kern/src/syscall.c b/kern/src/syscall.c
index 64f6a17..2673eb5 100644
--- a/kern/src/syscall.c
+++ b/kern/src/syscall.c
@@ -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 {
-               /* 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)
diff --git a/user/vmm/virtio_blk.c b/user/vmm/virtio_blk.c
index af3eab1..35ab72c 100644
--- a/user/vmm/virtio_blk.c
+++ b/user/vmm/virtio_blk.c
@@ -1,4 +1,4 @@
-#define _FILE_OFFSET_BITS=64
+#define _LARGEFILE64_SOURCE /* See feature_test_macros(7) */
 #include <sys/types.h>
 #include <unistd.h>
 #include <fcntl.h>
-- 
2.8.0.rc3.226.g39d4020

-- 
You received this message because you are subscribed to the Google Groups 
"Akaros" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to