diff src/console.c @ 26:a146855e16eb

bugfix
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Thu, 17 Jan 2019 19:43:22 +0900
parents 36bd61f5c847
children 1a64b5645cdd
line wrap: on
line diff
--- a/src/console.c	Thu Jan 17 19:22:48 2019 +0900
+++ b/src/console.c	Thu Jan 17 19:43:22 2019 +0900
@@ -218,7 +218,6 @@
 __code cbc_consoleread (struct inode *ip, char *dst, int n, __code(*next)(int ret))
 {
     uint target;
-    int c;
 
     iunlock(ip);
 
@@ -234,21 +233,24 @@
             }
 
             proc->cbc_arg.cbc_console_arg.n = n;
+            proc->cbc_arg.cbc_console_arg.target = target;
 	    proc->cbc_arg.cbc_console_arg.dst = dst;
 	    proc->cbc_arg.cbc_console_arg.ip = ip;
 	    proc->cbc_arg.cbc_console_arg.next = next;
             goto cbc_sleep(&input.r, &input.lock, cbc_consoleread1);
         }
+    }
 }
 
 __code cbc_consoleread1 (__code(*next)(int ret))
 {
     int cont = 1;
-    proc->cbc_arg.cbc_console_arg.n = n;
-    proc->cbc_arg.cbc_console_arg.dst = dst;
-    proc->cbc_arg.cbc_console_arg.ip = ip;
+    int n = proc->cbc_arg.cbc_console_arg.n;
+    int target = proc->cbc_arg.cbc_console_arg.target;
+    char* dst = proc->cbc_arg.cbc_console_arg.dst;
+    struct inode *ip = proc->cbc_arg.cbc_console_arg.ip;
     
-    c = input.buf[input.r++ % INPUT_BUF];
+    int c = input.buf[input.r++ % INPUT_BUF];
 
         if (c == C('D')) {  // EOF
             if (n < target) {