[dovecot-cvs] dovecot/src/lib-index/mbox mbox-rewrite.c,1.33,1.34
cras at procontrol.fi
cras at procontrol.fi
Tue Oct 29 20:01:12 EET 2002
Update of /home/cvs/dovecot/src/lib-index/mbox
In directory danu:/tmp/cvs-serv32087/mbox
Modified Files:
mbox-rewrite.c
Log Message:
mbox locking fixes
Index: mbox-rewrite.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mbox/mbox-rewrite.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- mbox-rewrite.c 28 Oct 2002 04:18:26 -0000 1.33
+++ mbox-rewrite.c 29 Oct 2002 18:01:10 -0000 1.34
@@ -413,16 +413,16 @@
return TRUE;
}
- tmp_fd = -1;
+ tmp_fd = -1; inbuf = NULL;
failed = TRUE; rewrite = FALSE;
do {
- /* lock before fscking to prevent race conditions between
- fsck's unlock and our lock. */
- inbuf = mbox_get_inbuf(index, 0, MAIL_LOCK_EXCLUSIVE);
- if (inbuf == NULL)
+ /* make sync() lock the file to prevent race conditions */
+ index->mbox_lock_next_sync = MAIL_LOCK_EXCLUSIVE;
+ if (!index->sync(index))
break;
- if (!index->sync(index))
+ inbuf = mbox_get_inbuf(index, 0, MAIL_LOCK_EXCLUSIVE);
+ if (inbuf == NULL)
break;
if ((index->header->flags &
More information about the dovecot-cvs
mailing list