diff src/file.c @ 33:7a63dacab7f8

fix cbc_read
author mir3636
date Tue, 22 Jan 2019 17:32:06 +0900
parents 96af12a50fdb
children ad1d3b268e2d
line wrap: on
line diff
--- a/src/file.c	Tue Jan 22 15:48:35 2019 +0900
+++ b/src/file.c	Tue Jan 22 17:32:06 2019 +0900
@@ -101,8 +101,10 @@
     return -1;
 }
 
-__code cbc_fileread1 (int r, struct file *f, __code (*next)(int ret))
+__code cbc_fileread1 (int r)
 {
+    struct file *f = proc->cbc_arg.cbc_console_arg.f;
+    __code (*next)(int ret) = cbc_ret;
     if (r > 0)
         f->off += r;
     iunlock(f->ip);
@@ -122,7 +124,8 @@
 
     if (f->type == FD_INODE) {
         ilock(f->ip);
-        goto cbc_readi(f->ip, addr, f->off, n, f, next);
+        proc->cbc_arg.cbc_console_arg.f = f;
+        goto cbc_readi(f->ip, addr, f->off, n, cbc_fileread1);
     }
 
     goto cbc_panic("fileread");