[dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-save.c,
1.40, 1.41 maildir-storage.h, 1.28, 1.29 maildir-sync.c, 1.38, 1.39
cras at dovecot.org
cras at dovecot.org
Thu Sep 2 19:53:38 EEST 2004
Update of /home/cvs/dovecot/src/lib-storage/index/maildir
In directory talvi:/tmp/cvs-serv5747/lib-storage/index/maildir
Modified Files:
maildir-save.c maildir-storage.h maildir-sync.c
Log Message:
Don't break if saving messages to maildir without index files.
Index: maildir-save.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/maildir/maildir-save.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- maildir-save.c 28 Aug 2004 09:32:07 -0000 1.40
+++ maildir-save.c 2 Sep 2004 16:53:36 -0000 1.41
@@ -323,6 +323,11 @@
return -1;
}
+ if (maildir_sync_index(ctx->ibox, TRUE) < 0) {
+ maildir_save_commit_abort(ctx, ctx->files);
+ return -1;
+ }
+
first_uid = maildir_uidlist_get_next_uid(ctx->ibox->uidlist);
mail_index_append_assign_uids(ctx->trans, first_uid, &last_uid);
Index: maildir-storage.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/maildir/maildir-storage.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- maildir-storage.h 29 Aug 2004 07:52:02 -0000 1.28
+++ maildir-storage.h 2 Sep 2004 16:53:36 -0000 1.29
@@ -42,6 +42,7 @@
struct mailbox_sync_context *
maildir_storage_sync_init(struct mailbox *box, enum mailbox_sync_flags flags);
int maildir_storage_sync_force(struct index_mailbox *ibox);
+int maildir_sync_index(struct index_mailbox *ibox, int partial);
struct mailbox_transaction_context *
maildir_transaction_begin(struct mailbox *box, int hide);
Index: maildir-sync.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/maildir/maildir-sync.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- maildir-sync.c 30 Jul 2004 05:08:35 -0000 1.38
+++ maildir-sync.c 2 Sep 2004 16:53:36 -0000 1.39
@@ -573,9 +573,8 @@
return 0;
}
-static int maildir_sync_index(struct maildir_sync_context *ctx)
+int maildir_sync_index(struct index_mailbox *ibox, int partial)
{
- struct index_mailbox *ibox = ctx->ibox;
struct maildir_index_sync_context sync_ctx;
struct maildir_uidlist_iter_ctx *iter;
struct mail_index_transaction *trans;
@@ -761,7 +760,7 @@
}
maildir_uidlist_iter_deinit(iter);
- if (!ctx->partial) {
+ if (!partial) {
/* expunge the rest */
for (seq++; seq <= hdr->messages_count; seq++)
mail_index_expunge(trans, seq);
@@ -892,7 +891,7 @@
/* finish uidlist syncing, but keep it still locked */
maildir_uidlist_sync_finish(ctx->uidlist_sync_ctx);
if (!ctx->ibox->syncing_commit) {
- if (maildir_sync_index(ctx) < 0)
+ if (maildir_sync_index(ctx->ibox, ctx->partial) < 0)
return -1;
}
More information about the dovecot-cvs
mailing list