From 9839f960344403921a7740bed060088054034a5d Mon Sep 17 00:00:00 2001 From: Heikki Levanto Date: Tue, 16 Jul 2002 09:52:20 +0000 Subject: [PATCH] fsync all files before closing them Safety, and also much more reliable timings --- bfile/mfile.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bfile/mfile.c b/bfile/mfile.c index 9a9793c..8e85e79 100644 --- a/bfile/mfile.c +++ b/bfile/mfile.c @@ -3,7 +3,7 @@ * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * - * $Id: mfile.c,v 1.45 2002-07-09 10:05:31 adam Exp $ + * $Id: mfile.c,v 1.46 2002-07-16 09:52:20 heikki Exp $ */ @@ -248,6 +248,7 @@ MFile_area mf_init(const char *name, const char *spec, const char *base) dent->d_name); return 0; } + fsync(fd); close(fd); if (dirp->max_bytes >= 0) dirp->avail_bytes -= part_f->bytes; @@ -410,6 +411,7 @@ int mf_close(MFile mf) for (i = 0; i < mf->no_files; i++) if (mf->files[i].fd >= 0) { + fsync(mf->files[i].fd); close(mf->files[i].fd); mf->files[i].fd = -1; } -- 1.7.10.4