summaryrefslogtreecommitdiff
path: root/sys/src/cmd/ndb
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@rei2.9hal>2012-03-16 22:42:14 +0100
committercinap_lenrek <cinap_lenrek@rei2.9hal>2012-03-16 22:42:14 +0100
commit9b2d3d426665b65e3cbba33504f103e86896ec9a (patch)
tree05b6db61e9f1e8d246c942f4cb5326fe21c934d9 /sys/src/cmd/ndb
parent9c71514b7158cfa8102b6a32775b783fcd9681ed (diff)
ndb: avoid double /net/ndb
Diffstat (limited to 'sys/src/cmd/ndb')
-rw-r--r--sys/src/cmd/ndb/cs.c4
-rw-r--r--sys/src/cmd/ndb/dblookup.c6
2 files changed, 10 insertions, 0 deletions
diff --git a/sys/src/cmd/ndb/cs.c b/sys/src/cmd/ndb/cs.c
index 10ecee536..3ab49efe4 100644
--- a/sys/src/cmd/ndb/cs.c
+++ b/sys/src/cmd/ndb/cs.c
@@ -336,6 +336,10 @@ ndbinit(void)
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;
diff --git a/sys/src/cmd/ndb/dblookup.c b/sys/src/cmd/ndb/dblookup.c
index 5c3995f7e..9ff423d2c 100644
--- a/sys/src/cmd/ndb/dblookup.c
+++ b/sys/src/cmd/ndb/dblookup.c
@@ -72,6 +72,12 @@ opendatabase(void)
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;