From 07cfc314441839d75e2ef8420a246f3dcbc517b4 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Fri, 13 May 2011 03:27:25 +0000 Subject: [PATCH] fix broken kbdproc buffering --- sys/src/cmd/rio/rio.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/src/cmd/rio/rio.c b/sys/src/cmd/rio/rio.c index 682512bee..04e0f8b54 100644 --- a/sys/src/cmd/rio/rio.c +++ b/sys/src/cmd/rio/rio.c @@ -1232,7 +1232,7 @@ kbdproc(void *arg) 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 @@ kbdproc(void *arg) } } n = e - p; - if(n > 0){ + if(n > 0) memmove(buf, p, n); - p = buf + n; - } + p = buf + n; } close(fd); }