shithub: riscv

Download patch

ref: cbb83c4fcee19d89d7b4927dcad734af02d24f24
parent: 11e38d21c8cd381eb8861b9b0cb7d7f25d68b8b4
author: cinap_lenrek <[email protected]>
date: Sun Feb 26 15:19:58 EST 2012

kbdfs: properly handle zero length write to kbdin

--- a/sys/src/cmd/aux/kbdfs/kbdfs.c
+++ b/sys/src/cmd/aux/kbdfs/kbdfs.c
@@ -1114,9 +1114,9 @@
 	case Qkbdin:
 		p = r->ifcall.data;
 		n = r->ifcall.count;
-		if(n <= 0)
-			n = 0;
 		r->ofcall.count = n;
+		if(n == 0)
+			break;
 		if(p[n-1] != 0){
 			/*
 			 * old format as used by bitsy keyboard: