code: drawterm

Download patch

ref: bf7b4c49fb935ada8ce6918c5a96bea2f95de041
parent: d4753beb37afbe0575fbe4f27ffec5117cd43424
author: Russ Cox <rsc@swtch.com>
date: Wed Oct 11 23:23:15 EDT 2006

fix the way Plan 9 does

--- a/kern/devmnt.c
+++ b/kern/devmnt.c
@@ -220,6 +220,16 @@
 	m->msize = f.msize;
 	unlock(&mntalloc.lk);
 
+	k = strlen(f.version);
+	if(returnlen > 0){
+		if(returnlen < k)
+			error(Eshort);
+		memmove(version, f.version, k);
+	}
+
+	poperror();	/* msg */
+	free(msg);
+
 	lock(&m->lk);
 	m->queue = 0;
 	m->rip = 0;
@@ -229,18 +239,9 @@
 	m->c = c;
 	unlock(&m->lk);
 
-	poperror();	/* msg */
 	poperror();	/* c */
 	qunlock(&c->umqlock);
 
-	k = strlen(f.version);
-	if(returnlen > 0){
-		if(returnlen < k){
-			free(msg);
-			error(Eshort);
-		}
-		memmove(version, f.version, k);
-	}
 	free(msg);
 	return k;
 }