shithub: riscv

Download patch

ref: eb1be5b4df533c4e5100296fb042e274da435b5b
parent: 796c41092aeb76bbbb151b56865b0355080d97c1
author: mischief <mischief@offblast.org>
date: Mon Aug 6 05:41:28 EDT 2018

devaoe: really fix unit numbering, to be 0-based

--- a/sys/src/9/port/devaoe.c
+++ b/sys/src/9/port/devaoe.c
@@ -949,7 +949,7 @@
 		return unitgen(c, TYPE(c->qid), dp);
 	case Qdevlinkdir:
 		i = UNIT(c->qid);
-		if(i > Maxunits || i > units.ref)
+		if(i >= Maxunits || i >= units.ref)
 			return -1;
 		d = unit2dev(i);
 		if(s == DEVDOTDOT){
@@ -1728,7 +1728,7 @@
 {
 	int x;
 
-	x = incref(&units);
+	x = incref(&units)-1;
 	if(x >= Maxunits){
 		decref(&units);
 		x = -1;