dovecot: Fixes to handling maildir files.
dovecot at dovecot.org
dovecot at dovecot.org
Sun Oct 21 19:15:00 EEST 2007
details: http://hg.dovecot.org/dovecot/rev/835daa872b0a
changeset: 6601:835daa872b0a
user: Timo Sirainen <tss at iki.fi>
date: Sun Oct 21 19:14:56 2007 +0300
description:
Fixes to handling maildir files.
diffstat:
4 files changed, 18 insertions(+), 5 deletions(-)
src/lib-storage/index/dbox/dbox-file.c | 2 ++
src/lib-storage/index/dbox/dbox-index.c | 10 +++++++++-
src/lib-storage/index/dbox/dbox-sync-file.c | 7 +++++--
src/lib-storage/index/dbox/dbox-sync.c | 4 ++--
diffs (74 lines):
diff -r 416d9ee66047 -r 835daa872b0a src/lib-storage/index/dbox/dbox-file.c
--- a/src/lib-storage/index/dbox/dbox-file.c Sun Oct 21 18:58:00 2007 +0300
+++ b/src/lib-storage/index/dbox/dbox-file.c Sun Oct 21 19:14:56 2007 +0300
@@ -942,6 +942,8 @@ int dbox_file_metadata_write(struct dbox
/* nothing to write */
return 1;
}
+ if (file->maildir_file)
+ return 0;
offset = file->metadata_read_offset +
sizeof(struct dbox_metadata_header);
diff -r 416d9ee66047 -r 835daa872b0a src/lib-storage/index/dbox/dbox-index.c
--- a/src/lib-storage/index/dbox/dbox-index.c Sun Oct 21 18:58:00 2007 +0300
+++ b/src/lib-storage/index/dbox/dbox-index.c Sun Oct 21 19:14:56 2007 +0300
@@ -91,11 +91,14 @@ static int dbox_index_parse_maildir(stru
char *p;
unsigned long uid;
+ if (*line++ != ' ')
+ return -1;
+
uid = strtoul(line, &p, 10);
if (*p++ != ' ' || *p == '\0' || uid == 0 || uid >= (uint32_t)-1)
return -1;
- rec->data = p_strdup(index->record_data_pool, p);
+ rec->data = p_strdup(index->record_data_pool, line);
return 0;
}
@@ -323,6 +326,11 @@ dbox_index_record_lookup(struct dbox_ind
if ((file_id & DBOX_FILE_ID_FLAG_UID) != 0)
return NULL;
+
+ if (index->fd == -1) {
+ if (dbox_index_refresh(index) < 0)
+ return NULL;
+ }
records = array_get_modifiable(&index->records, &count);
return bsearch(&file_id, records, count, sizeof(*records),
diff -r 416d9ee66047 -r 835daa872b0a src/lib-storage/index/dbox/dbox-sync-file.c
--- a/src/lib-storage/index/dbox/dbox-sync-file.c Sun Oct 21 18:58:00 2007 +0300
+++ b/src/lib-storage/index/dbox/dbox-sync-file.c Sun Oct 21 19:14:56 2007 +0300
@@ -193,8 +193,11 @@ dbox_sync_file_changes(struct dbox_sync_
dbox_sync_update_metadata(ctx, file, entry, seq);
ret = dbox_file_metadata_write(file);
if (ret <= 0) {
- /* FIXME: handle ret=0 case by splitting the file */
- return ret;
+ if (ret < 0)
+ return -1;
+ /* FIXME: handle ret=0 case by splitting the file
+ (or converting maildir file to dbox) */
+ return 1;
}
mail_index_update_flags(ctx->trans, seq, MODIFY_REMOVE,
diff -r 416d9ee66047 -r 835daa872b0a src/lib-storage/index/dbox/dbox-sync.c
--- a/src/lib-storage/index/dbox/dbox-sync.c Sun Oct 21 18:58:00 2007 +0300
+++ b/src/lib-storage/index/dbox/dbox-sync.c Sun Oct 21 19:14:56 2007 +0300
@@ -233,8 +233,8 @@ static bool dbox_sync_want_flush_dirty(s
const void *data;
size_t data_size;
- if (mbox->last_interactive_change <
- ioloop_time - DBOX_FLUSH_SECS_INTERACTIVE)
+ /*if (mbox->last_interactive_change <
+ ioloop_time - DBOX_FLUSH_SECS_INTERACTIVE)*/
return TRUE;
mail_index_get_header_ext(mbox->ibox.view, mbox->dbox_hdr_ext_id,
More information about the dovecot-cvs
mailing list