shithub: plan9front

Download patch

ref: c1afd1158c54e93890168c7af3174ec1ac0914b8
parent: f00fb547730cb40e6d3fdf9e660409ae6cb904af
author: qwx <qwx@sciops.net>
date: Sun Jan 15 15:23:42 EST 2023

games/dmid: properly skip delay field from stream

--- a/sys/src/games/dmid.c
+++ b/sys/src/games/dmid.c
@@ -397,7 +397,7 @@
 
 	dprint(" [%zd] ", x - tr);
 	e = get8(x);
-	if((e & 0x80) == 0){
+	if(!stream && (e & 0x80) == 0){
 		x->p--;
 		e = x->ev;
 		if((e & 0x80) == 0)
@@ -580,13 +580,12 @@
 	if(stream){
 		if(proccreate(tproc, nil, mainstacksize) < 0)
 			sysfatal("proccreate: %r");
-		xs.p = u;
-		xs.e = u + sizeof u;
 		for(;;){
 			if((n = Bread(ib, u, sizeof u)) != sizeof u)
 				break;
-			u[0] = 0;
 			xs.p = u;
+			xs.e = u + n;
+			getvar(&xs);
 			ev(&xs);
 		}
 		threadexitsall(n < 0 ? "read: %r" : nil);