[dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-sync.c, 1.77.2.3, 1.77.2.4
tss at dovecot.org
tss at dovecot.org
Thu Jan 25 16:01:37 UTC 2007
Update of /var/lib/cvs/dovecot/src/lib-storage/index/maildir
In directory talvi:/tmp/cvs-serv17196
Modified Files:
Tag: branch_1_0
maildir-sync.c
Log Message:
Error handling fixes
Index: maildir-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/maildir/maildir-sync.c,v
retrieving revision 1.77.2.3
retrieving revision 1.77.2.4
diff -u -d -r1.77.2.3 -r1.77.2.4
--- maildir-sync.c 7 Nov 2006 21:22:06 -0000 1.77.2.3
+++ maildir-sync.c 25 Jan 2007 16:01:34 -0000 1.77.2.4
@@ -497,8 +497,10 @@
}
}
- if (mail_index_lookup_uid(ctx->view, seq, &uid) < 0)
+ if (mail_index_lookup_uid(ctx->view, seq, &uid) < 0) {
+ mail_storage_set_index_error(&ctx->mbox->ibox);
return -1;
+ }
ctx->seq = seq;
if (expunged) {
@@ -551,8 +553,10 @@
if (mail_index_lookup_uid_range(view, sync_rec->uid1,
sync_rec->uid2,
&sync_copy.uid1,
- &sync_copy.uid2) < 0)
+ &sync_copy.uid2) < 0) {
+ mail_storage_set_index_error(&ctx->mbox->ibox);
return -1;
+ }
if (sync_copy.uid1 == 0) {
/* UIDs were expunged */
@@ -581,8 +585,11 @@
int ret;
ret = mail_index_sync_next(ctx->sync_ctx, &sync_rec);
- if (ret <= 0)
+ if (ret <= 0) {
+ if (ret < 0)
+ mail_storage_set_index_error(&ctx->mbox->ibox);
return ret;
+ }
ARRAY_CREATE(&ctx->sync_recs, pool_datastack_create(),
struct mail_index_sync_rec, 32);
@@ -593,6 +600,9 @@
ret = mail_index_sync_next(ctx->sync_ctx, &sync_rec);
} while (ret > 0);
+ if (ret < 0)
+ mail_storage_set_index_error(&ctx->mbox->ibox);
+
if (maildir_sync_record(ctx, NULL) < 0)
return -1;
return ret;
@@ -897,9 +907,10 @@
mail_index_transaction_rollback(&sync_ctx->trans);
else {
if (mail_index_transaction_commit(&sync_ctx->trans,
- &seq, &offset) < 0)
+ &seq, &offset) < 0) {
+ mail_storage_set_index_error(&mbox->ibox);
ret = -1;
- else if (seq != 0) {
+ } else if (seq != 0) {
mbox->ibox.commit_log_file_seq = seq;
mbox->ibox.commit_log_file_offset = offset;
}
@@ -908,17 +919,15 @@
if (ret < 0 || cancel)
mail_index_sync_rollback(&sync_ctx->sync_ctx);
else {
- if (mail_index_sync_commit(&sync_ctx->sync_ctx) < 0)
+ if (mail_index_sync_commit(&sync_ctx->sync_ctx) < 0) {
+ mail_storage_set_index_error(&mbox->ibox);
ret = -1;
- else {
+ } else {
mbox->ibox.commit_log_file_seq = 0;
mbox->ibox.commit_log_file_offset = 0;
}
}
- if (ret < 0)
- mail_storage_set_index_error(&mbox->ibox);
-
maildir_keywords_sync_deinit(sync_ctx->keywords_sync_ctx);
sync_ctx->keywords_sync_ctx = NULL;
@@ -1046,6 +1055,7 @@
}
if (mail_index_lookup(view, seq, &rec) < 0) {
+ mail_storage_set_index_error(&mbox->ibox);
ret = -1;
break;
}
@@ -1135,6 +1145,7 @@
/* update keywords if they have changed */
if (mail_index_lookup_keywords(view, seq, &idx_keywords) < 0) {
+ mail_storage_set_index_error(&mbox->ibox);
ret = -1;
break;
}
More information about the dovecot-cvs
mailing list