diff --git a/tasks/mm0/src/file.c b/tasks/mm0/src/file.c index 6a197e6..23d8aa8 100644 --- a/tasks/mm0/src/file.c +++ b/tasks/mm0/src/file.c @@ -645,7 +645,9 @@ int sys_write(l4id_t sender, int fd, void *buf, int count) * of this change when the file is flushed (e.g. via fflush() * or close()) */ - vmfile->length += count; + if (task->fd[fd].cursor + count > vmfile->length) + vmfile->length = task->fd[fd].cursor + count; + task->fd[fd].cursor += count; retval = count; diff --git a/tasks/mm0/src/pagers.c b/tasks/mm0/src/pagers.c index e640434..b68e853 100644 --- a/tasks/mm0/src/pagers.c +++ b/tasks/mm0/src/pagers.c @@ -87,7 +87,7 @@ int file_page_out(struct vm_object *vm_obj, unsigned long page_offset) /* Map the page to vfs task */ l4_map(paddr, vaddr, 1, MAP_USR_RW_FLAGS, VFS_TID); - /* Syscall to vfs to read into the page. */ + /* Syscall to vfs to write page back to file. */ if ((err = vfs_write(vm_file_to_vnum(f), page_offset, 1, vaddr)) < 0) goto out_err;