+ /* Create a file to represent database recovery. While this file
+ * exists, the database is being recovered, and all other clients will
+ * sleep until recovery is complete, and this file goes away. */
+ if (!have_lock && db->lockfd > -1 && lock.l_start == 0) {
+ if (stat(recover_file, &rsb) < 0) {
+ if ((rfd = open(recover_file, O_RDWR | O_CREAT, 0666)) > -1) {
+ DBEXTRAS |= DB_RECOVER;
+ have_lock = 1;
+ }
+ }
+ else {
+ while(stat(recover_file, &rsb) == 0) {
+ sleep(1);
+ }
+ }
+ }
+