]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
fsync() mbox before unlocking if we've modified it
authorTimo Sirainen <tss@iki.fi>
Sun, 20 Jun 2004 11:23:39 +0000 (14:23 +0300)
committerTimo Sirainen <tss@iki.fi>
Sun, 20 Jun 2004 11:23:39 +0000 (14:23 +0300)
--HG--
branch : HEAD

src/lib-storage/index/mbox/mbox-sync.c

index 0ce7123c7b73afe7c260167a47e92e61cdd3fd3c..7aa692bced5d7c6b56798e0ef1cf95d9f8afae59 100644 (file)
@@ -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;