shithub: riscv

Download patch

ref: 07cfc314441839d75e2ef8420a246f3dcbc517b4
parent: bb45ddca85109a945c8293c180febd534d35b0fb
author: cinap_lenrek <cinap_lenrek@localhost>
date: Thu May 12 23:27:25 EDT 2011

fix broken kbdproc buffering

--- a/sys/src/cmd/rio/rio.c
+++ b/sys/src/cmd/rio/rio.c
@@ -1232,7 +1232,7 @@
 			Rune r;
 
 			e = buf + sizeof(buf);
-			if((n = read(fd, p, e-p)) < 0)
+			if((n = read(fd, p, e-p)) <= 0)
 				break;
 			e = p + n;
 			while(p < e && fullrune(p, e - p)){
@@ -1243,10 +1243,9 @@
 				}
 			}
 			n = e - p;
-			if(n > 0){
+			if(n > 0)
 				memmove(buf, p, n);
-				p = buf + n;
-			}
+			p = buf + n;
 		}
 		close(fd);
 	}