changeset 278:abd08fadb297 HEAD

mail_index_data_sync_file() now doesn't complain if mmap_used_length is 0
author Timo Sirainen <tss@iki.fi>
date Fri, 20 Sep 2002 09:07:58 +0300
parents 6173b306d276
children 49f4b0be0d87
files src/lib-index/mail-index-data.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-index-data.c	Fri Sep 20 08:40:43 2002 +0300
+++ b/src/lib-index/mail-index-data.c	Fri Sep 20 09:07:58 2002 +0300
@@ -460,14 +460,14 @@
 	if (data->anon_mmap)
 		return TRUE;
 
-	if (data->mmap_base != NULL) {
+	if (data->mmap_base != NULL && data->mmap_used_length > 0) {
 		if (msync(data->mmap_base, data->mmap_used_length, MS_SYNC) < 0)
 			return index_data_set_syscall_error(data, "msync()");
+
+		if (fsync(data->fd) < 0)
+			return index_data_set_syscall_error(data, "fsync()");
 	}
 
-	if (fsync(data->fd) < 0)
-		return index_data_set_syscall_error(data, "fsync()");
-
 	return TRUE;
 }