shithub: riscv

Download patch

ref: 52e4e51b50589ecb2b06559c28b7ce9f682815be
parent: b0384439590d2899456b84b785b365a616ffaf2c
author: cinap_lenrek <[email protected]>
date: Wed Dec 11 18:52:05 EST 2019

devcons: fix write length of writebintime() (thanks BurnZeZ)

--- a/sys/src/9/port/devcons.c
+++ b/sys/src/9/port/devcons.c
@@ -913,7 +913,8 @@
 	vlong delta;
 	long period;
 
-	n--;
+	if(--n <= 0)
+		error(Ebadtimectl);
 	p = (uchar*)buf + 1;
 	switch(*buf){
 	case 'n':
@@ -938,7 +939,7 @@
 		todsetfreq(fasthz);
 		break;
 	}
-	return n;
+	return n+1;
 }
 
 void