[dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-save.c,1.23,1.24

cras at procontrol.fi cras at procontrol.fi
Mon Apr 21 19:41:21 EEST 2003


Update of /home/cvs/dovecot/src/lib-storage/index/maildir
In directory danu:/tmp/cvs-serv24994/index/maildir

Modified Files:
	maildir-save.c 
Log Message:
fsync() saved mails



Index: maildir-save.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/maildir/maildir-save.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- maildir-save.c	9 Apr 2003 20:10:02 -0000	1.23
+++ maildir-save.c	21 Apr 2003 15:41:19 -0000	1.24
@@ -53,8 +53,18 @@
 		fname = NULL;
 
 	o_stream_unref(output);
-	if (close(fd) < 0)
+	/* FIXME: when saving multiple messages, we could get better
+	   performance if we left the fd open and fsync()ed it later */
+	if (fsync(fd) < 0) {
+		mail_storage_set_critical(ibox->box.storage,
+					  "fsync() failed for %s: %m", path);
 		fname = NULL;
+	}
+	if (close(fd) < 0) {
+		mail_storage_set_critical(ibox->box.storage,
+					  "close() failed for %s: %m", path);
+		fname = NULL;
+	}
 
 	if (fname == NULL)
 		(void)unlink(path);




More information about the dovecot-cvs mailing list