1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
  | 
--- libatalk/cnid/cnid_open.c.orig	Thu Aug 16 10:30:29 2001
+++ libatalk/cnid/cnid_open.c	Sun Sep  2 03:13:49 2001
@@ -37,6 +37,7 @@
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
 
+#ifdef CNID_DB
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
@@ -83,7 +84,7 @@
 #define DBVERSION        DBVERSION1
 
 #define DBOPTIONS    (DB_CREATE | DB_INIT_MPOOL | DB_INIT_LOCK | \
-DB_INIT_LOG | DB_INIT_TXN | DB_TXN_NOSYNC | DB_RECOVER)
+DB_INIT_LOG | DB_INIT_TXN | DB_RECOVER)
 
 #define MAXITER     0xFFFF /* maximum number of simultaneously open CNID
 			    * databases. */
@@ -100,7 +101,7 @@
 
 /* sort did's and then names. this is for unix paths.
  * i.e., did/unixname lookups. */
-static int compare_unix(const DBT *a, const DBT *b)
+static int compare_unix(DB* db, const DBT *a, const DBT *b)
 {
   u_int8_t *sa, *sb;
   int len, ret;
@@ -214,6 +215,8 @@
     goto fail_lock;
   }
 
+  /* Check to see if a DBENV already exists.  If it does, join it. */
+  if (db->dbenv->open(db->dbenv, path, DB_JOINENV, 0666)) {
   if (db->dbenv->open(db->dbenv, path, DBOPTIONS, 0666)) {
 
     /* try with a shared memory pool */
@@ -229,6 +232,7 @@
     open_flag = DB_RDONLY;
     syslog(LOG_INFO, "cnid_open: read-only CNID database");
   }
+  }
 
   /* did/name reverse mapping. we use a btree for this one. */
   if (db_create(&db->db_didname, db->dbenv, 0))
@@ -358,3 +362,4 @@
   free(db);
   return NULL;
 }
+#endif /* CNID_DB */
 
  |