summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwrog <wrog>2007-11-12 11:17:03 (GMT)
committerwrog <wrog>2007-11-12 11:17:03 (GMT)
commitc9861041889dd821860edf41d0ea1483e7f1f27e (patch)
treedcc75674a0c3852874821dd462588fdb8a86e645
parent480dd1eb952008ee52fc616e15d436e0a06a8ebd (diff)
downloadmoo-c9861041889dd821860edf41d0ea1483e7f1f27e.zip
moo-c9861041889dd821860edf41d0ea1483e7f1f27e.tar.gz
moo-c9861041889dd821860edf41d0ea1483e7f1f27e.tar.bz2
moo-c9861041889dd821860edf41d0ea1483e7f1f27e.tar.xz
sync so that checkpoint is physically written before prior checkpoint is unlinkedWAIF.ROOT.4sourceforge
-rw-r--r--db_file.c6
-rw-r--r--my-stdio.h4
-rw-r--r--my-unistd.h4
3 files changed, 14 insertions, 0 deletions
diff --git a/db_file.c b/db_file.c
index 0918286..b9c7827 100644
--- a/db_file.c
+++ b/db_file.c
@@ -20,6 +20,7 @@
*****************************************************************************/
#include "my-stat.h"
+#include "my-unistd.h"
#include "my-stdio.h"
#include "my-stdlib.h"
@@ -608,6 +609,8 @@ dump_database(Dump_Reason reason)
goto retryDumping;
}
} else {
+ fflush(f);
+ fsync(fileno(f));
fclose(f);
oklog("%s on %s finished\n", reason_names[reason], temp_name);
if (reason != DUMP_PANIC) {
@@ -735,6 +738,9 @@ char rcsid_db_file[] = "$Id$";
/*
* $Log$
+ * Revision 1.6 2007/11/12 11:17:03 wrog
+ * sync so that checkpoint is physically written before prior checkpoint is unlinked
+ *
* Revision 1.5 2004/05/22 01:25:43 wrog
* merging in WROGUE changes (W_SRCIP, W_STARTUP, W_OOB)
*
diff --git a/my-stdio.h b/my-stdio.h
index 6c705bb..58060bd 100644
--- a/my-stdio.h
+++ b/my-stdio.h
@@ -27,6 +27,7 @@
extern int fclose(FILE *);
extern int fflush(FILE *);
+extern int fileno(FILE *);
extern size_t fwrite(const void *, size_t, size_t, FILE *);
extern int fgetc(FILE *);
extern int fprintf(FILE *, const char *,...);
@@ -66,6 +67,9 @@ extern int vfscanf(FILE *, const char *, va_list);
/*
* $Log$
+ * Revision 1.4 2007/11/12 11:17:03 wrog
+ * sync so that checkpoint is physically written before prior checkpoint is unlinked
+ *
* Revision 1.3 1998/12/14 13:18:17 nop
* Merge UNSAFE_OPTS (ref fixups); fix Log tag placement to fit CVS whims
*
diff --git a/my-unistd.h b/my-unistd.h
index 5be5615..37e7273 100644
--- a/my-unistd.h
+++ b/my-unistd.h
@@ -39,11 +39,15 @@ extern int read(int, void *, unsigned);
extern unsigned sleep(unsigned);
extern int unlink(const char *);
extern int write(int, const void *, unsigned);
+extern int fsync(int);
#endif
/*
* $Log$
+ * Revision 1.4 2007/11/12 11:17:03 wrog
+ * sync so that checkpoint is physically written before prior checkpoint is unlinked
+ *
* Revision 1.3 1998/12/14 13:18:23 nop
* Merge UNSAFE_OPTS (ref fixups); fix Log tag placement to fit CVS whims
*