shithub: riscv

Download patch

ref: a36ab714ee9ee9764b590fd4bcf6fe6feb44e45b
parent: 2fa44c883eaf727a95f00257c0997bd63c66f7f6
parent: c39aecc11186aa7ec7e4981614bfa3765d4af99e
author: cinap_lenrek <cinap_lenrek@cirno>
date: Sun Jun 5 00:00:46 EDT 2011

merge

--- a/sys/src/cmd/cwfs/cw.c
+++ b/sys/src/cmd/cwfs/cw.c
@@ -1448,19 +1448,21 @@
 
 	cw->depth--;
 
-	if(na){
-		if(b){
-			p = getbuf(cw->dev, na, Brd);
-			if(!p || checktag(p, tag, qp)){
-				fprint(2, "cwrecur: b/p null %s\n", cw->name);
-				na = 0;
-			} else {
-				memmove(p->iobuf, b->iobuf, RBUFSIZE);
-				p->flags |= Bmod|Bimm;
-			}
-			if(p)
-				putbuf(p);
+	if(b){
+		p = getbuf(cw->dev, na ? na : addr, Brd);
+		if(!p || checktag(p, tag, qp)){
+			fprint(2, "cwrecur: b/p null\n");
+			na = 0;
+		} else {
+			memmove(p->iobuf, b->iobuf, RBUFSIZE);
+			p->flags |= Bmod|Bimm;
 		}
+		if(p)
+			putbuf(p);
+		putbuf(b);
+	}
+
+	if(na){
 		if(shouldstop){
 			if(cw->falsehits < 10)
 				fprint(2, "shouldstop %lld %lld t=%s %s\n",
@@ -1469,8 +1471,6 @@
 			cw->falsehits++;
 		}
 	}
-	if(b)
-		putbuf(b);
 
 	return na;
 }