From: Timo Sirainen Date: Sun, 20 Jun 2004 11:23:39 +0000 (+0300) Subject: fsync() mbox before unlocking if we've modified it X-Git-Tag: 1.1.alpha1~3899 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8573a63139eab50fee1e497276f126f0d04d5637;p=thirdparty%2Fdovecot%2Fcore.git fsync() mbox before unlocking if we've modified it --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/mbox/mbox-sync.c b/src/lib-storage/index/mbox/mbox-sync.c index 0ce7123c7b..7aa692bced 100644 --- a/src/lib-storage/index/mbox/mbox-sync.c +++ b/src/lib-storage/index/mbox/mbox-sync.c @@ -1159,6 +1159,13 @@ int mbox_sync(struct index_mailbox *ibox, int last_commit, } } + if (ret == 0 && ibox->mbox_lock_type == F_WRLCK) { + if (fsync(ibox->mbox_fd) < 0) { + mbox_set_syscall_error(ibox, "fsync()"); + ret = -1; + } + } + if (sync_ctx.lock_id != 0 && ibox->mbox_lock_type != F_RDLCK) { /* drop to read lock */ unsigned int lock_id = 0;