[dovecot-cvs] dovecot/src/lib-index/mbox mbox-append.c,1.47,1.48
mbox-sync-full.c,1.22,1.23
cras at procontrol.fi
cras at procontrol.fi
Tue Nov 11 18:37:01 EET 2003
Update of /home/cvs/dovecot/src/lib-index/mbox
In directory danu:/tmp/cvs-serv8035/lib-index/mbox
Modified Files:
mbox-append.c mbox-sync-full.c
Log Message:
Fixed "LF not found where expected" error happening in some conditions.
Index: mbox-append.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mbox/mbox-append.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- mbox-append.c 10 Nov 2003 21:53:23 -0000 1.47
+++ mbox-append.c 11 Nov 2003 16:36:59 -0000 1.48
@@ -182,10 +182,10 @@
int ret;
if (!index->set_lock(index, MAIL_LOCK_EXCLUSIVE))
- return FALSE;
+ return -1;
if (mail_cache_transaction_begin(index->cache, TRUE, &trans_ctx) <= 0)
- return FALSE;
+ return -1;
do {
offset = input->v_offset;
@@ -234,5 +234,5 @@
if (!mail_cache_transaction_end(trans_ctx))
ret = -1;
- return ret >= 0;
+ return ret;
}
Index: mbox-sync-full.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mbox/mbox-sync-full.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- mbox-sync-full.c 9 Nov 2003 18:26:25 -0000 1.22
+++ mbox-sync-full.c 11 Nov 2003 16:36:59 -0000 1.23
@@ -214,7 +214,7 @@
int dirty, ret;
if (mail_cache_lock(index->cache, FALSE) <= 0)
- return FALSE;
+ return -1;
mail_cache_unlock_later(index->cache);
mbox_skip_empty_lines(input);
@@ -225,7 +225,7 @@
memcmp(data, "From ", 5) != 0) {
index_set_error(index, "File isn't in mbox format: %s",
index->mailbox_path);
- return FALSE;
+ return -1;
}
/* we'll go through the mailbox and index in order matching the
@@ -252,7 +252,7 @@
"Error syncing mbox file %s: "
"LF not found where expected",
index->mailbox_path);
- return FALSE;
+ return -1;
}
}
@@ -260,7 +260,7 @@
if (ret < 0) {
if (input->eof)
break;
- return FALSE;
+ return -1;
}
if (ret == 0) {
@@ -273,7 +273,7 @@
if (rec != NULL) {
if (!index->expunge(index, rec, INDEX_END_RECORD(index)-1,
seq, index->header->messages_count, TRUE))
- return FALSE;
+ return -1;
}
if (!dirty &&
@@ -283,7 +283,7 @@
}
if ((index->set_flags & MAIL_INDEX_HDR_FLAG_REBUILD))
- return TRUE;
+ return 1;
else
return mbox_index_append_stream(index, input);
}
@@ -293,7 +293,7 @@
struct istream *input;
struct stat orig_st, st;
uoff_t continue_offset;
- int failed;
+ int ret, failed;
i_assert(index->lock_type == MAIL_LOCK_EXCLUSIVE);
@@ -306,8 +306,9 @@
continue_offset = (uoff_t)-1;
failed = TRUE;
} else {
- failed = !mbox_sync_from_stream(index, input);
- continue_offset = failed || input->eof ||
+ ret = mbox_sync_from_stream(index, input);
+ failed = ret < 0;
+ continue_offset = ret != 0 ||
(index->set_flags & MAIL_INDEX_HDR_FLAG_REBUILD) ?
(uoff_t)-1 : input->v_offset;
i_stream_unref(input);
@@ -333,14 +334,14 @@
i_stream_seek(input, continue_offset);
failed = !mbox_index_append_stream(index, input);
} else {
- failed = !mbox_sync_from_stream(index, input);
+ failed = mbox_sync_from_stream(index, input) <= 0;
}
if (index->mbox_rewritten) {
/* rewritten, sync again */
index->mbox_rewritten = FALSE;
i_stream_seek(input, 0);
- failed = !mbox_sync_from_stream(index, input);
+ failed = mbox_sync_from_stream(index, input) <= 0;
}
i_stream_unref(input);
More information about the dovecot-cvs
mailing list