close(dbdirfd);
}
+ /*
+ Before we do anything else, check if there is an instance of cnid_dbd
+ running already and silently exit if yes.
+ */
+ lockfd = get_lock(dbpath);
+
/* Prepare upgrade ? */
if (prep_upgrade) {
- lockfd = get_lock(dbpath);
if (dbif_prep_upgrade(dbpath))
goto exit_failure;
goto exit_success;
/* 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 -f %s/*", dbpath);
dbd_log( LOGDEBUG, "Removing old database of volume: '%s'", volpath);
system(cmd);
dbd_log( LOGDEBUG, "Removed old database.");
+ lockfd = get_lock(dbpath);
}
- /*
- Before we do anything else, check if there is an instance of cnid_dbd
- running already and silently exit if yes.
- */
- lockfd = get_lock(dbpath);
-
/*
Lets start with the BerkeleyDB stuff
*/