]> arthur.barton.de Git - netatalk.git/blobdiff - etc/cnid_dbd/cmd_dbd.c
Merge 2-1
[netatalk.git] / etc / cnid_dbd / cmd_dbd.c
index de1803eacb5aeaf688f9f4904720e0748df54291..ed67a9a54bc14aecf0d38dd3e0a9c8610714a431 100644 (file)
@@ -90,15 +90,15 @@ static int exclusive;           /* Exclusive volume access */
 static struct db_param db_param = {
     NULL,                       /* Volume dirpath */
     1,                          /* bdb logfile autoremove */
-    256 * 1024,                  /* bdb cachesize (256 MB) */
-    5000,                       /* maxlocks */
-    5000,                       /* maxlockobjs */
-    -1,                         /* not used ... */
-    -1,
-    "",
-    -1,
-    -1,
-    -1
+    64 * 1024,                  /* bdb cachesize (64 MB) */
+    DEFAULT_MAXLOCKS,           /* maxlocks */
+    DEFAULT_MAXLOCKOBJS,        /* maxlockobjs */
+    0,                          /* flush_interval */
+    0,                          /* flush_frequency */
+    0,                          /* usock_file */
+    -1,                         /* fd_table_size */
+    -1,                         /* idle_timeout */
+    -1                          /* max_vols */
 };
 static char dbpath[MAXPATHLEN+1];   /* Path to the dbd database */
 
@@ -437,6 +437,7 @@ int main(int argc, char **argv)
     /* Check if -f is requested and wipe db if yes */
     if ((flags & DBD_FLAGS_FORCE) && rebuild && (volinfo.v_flags & AFPVOL_CACHE)) {
         char cmd[8 + MAXPATHLEN];
+        close(lockfd);
         snprintf(cmd, 8 + MAXPATHLEN, "rm -rf \"%s\"", dbpath);
         dbd_log( LOGDEBUG, "Removing old database of volume: '%s'", volpath);
         system(cmd);
@@ -445,6 +446,7 @@ int main(int argc, char **argv)
             exit(EXIT_FAILURE);
         }
         dbd_log( LOGDEBUG, "Removed old database.");
+        lockfd = get_lock(dbpath);
     }
 
     /* 
@@ -481,9 +483,11 @@ int main(int argc, char **argv)
 
     /* Cleanup */
     dbd_log(LOGDEBUG, "Closing db");
-    if (! nocniddb && dbif_close(dbd) < 0) {
-        dbd_log( LOGSTD, "Error closing database");
-        goto exit_failure;
+    if (! nocniddb) {
+        if (dbif_close(dbd) < 0) {
+            dbd_log( LOGSTD, "Error closing database");
+            goto exit_failure;
+        }
     }
 
 exit_success: