git: 9front

Download patch

ref: fa059b6a930f2c3354f1d28729347d59c5b76efa
parent: a4313f26facb302a3089d98f158ccd248ce734db
author: cinap_lenrek <cinap_lenrek@rei2.9hal>
date: Fri Mar 16 18:42:14 EDT 2012

ndb: avoid double /net/ndb

--- a/sys/src/cmd/ndb/cs.c
+++ b/sys/src/cmd/ndb/cs.c
@@ -336,6 +336,10 @@
 	if(db == nil)
 		error("can't open network database");
 
+	for(netdb = db; netdb; netdb = netdb->next)
+		if(strcmp(netdb->file, netndb) == 0)
+			return;
+
 	netdb = ndbopen(netndb);
 	if(netdb != nil){
 		netdb->nohash = 1;
--- a/sys/src/cmd/ndb/dblookup.c
+++ b/sys/src/cmd/ndb/dblookup.c
@@ -72,6 +72,12 @@
 	xdb = ndbopen(dbfile);		/* /lib/ndb */
 
 	snprint(netdbnm, sizeof netdbnm, "%s/ndb", mntpt);
+	for(netdb = xdb; netdb; netdb = netdb->next)
+		if(strcmp(netdb->file, netdbnm) == 0){
+			db = xdb;
+			return 0;
+		}
+
 	netdb = ndbopen(netdbnm);	/* /net/ndb */
 	if(netdb)
 		netdb->nohash = 1;
--