code: plan9front

Download patch

ref: 6d9b3408d945fc9645c27b42db0a9918752324fd
parent: 585365f5bbffae93eac3f1a4ba476aa0cab3f95d
author: Michael Forney <mforney@mforney.org>
date: Sat Oct 22 14:40:21 EDT 2022

exportfs: fix clunk of first attach with -S

0 is a valid mid so should not be used as a nil value, since then the
first mount (mid=0) will never be unmounted.

--- a/sys/src/cmd/exportfs/io.c
+++ b/sys/src/cmd/exportfs/io.c
@@ -119,7 +119,7 @@
 	l = &fidhash(nr);
 	for(f = *l; f != nil; f = f->next) {
 		if(f->nr == nr) {
-			if(f->mid) {
+			if(f->mid != -1) {
 				snprint(buf, sizeof(buf), "/mnt/exportfs/%d", f->mid);
 				unmount(0, buf);
 				psmap[f->mid] = 0;
@@ -171,7 +171,7 @@
 	*l = new;
 	new->nr = nr;
 	new->fid = -1;
-	new->mid = 0;
+	new->mid = -1;
 
 	return new;	
 }