]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dbox: Fixes to handling maildir-converted files.
authorTimo Sirainen <tss@iki.fi>
Mon, 12 Jan 2009 15:32:38 +0000 (10:32 -0500)
committerTimo Sirainen <tss@iki.fi>
Mon, 12 Jan 2009 15:32:38 +0000 (10:32 -0500)
--HG--
branch : HEAD

src/lib-storage/index/dbox/dbox-index.c
src/lib-storage/index/dbox/dbox-sync-file.c

index ff41a4d4bc7bd2c9edce8d1da54e02d32c099871..79dae2e479de7f22ab20080752a1bef0ddb55901 100644 (file)
@@ -90,7 +90,7 @@ void dbox_index_deinit(struct dbox_index **_index)
 static int dbox_index_parse_maildir(struct dbox_index *index, const char *line,
                                    struct dbox_index_record *rec)
 {
-       char *p, *p2;
+       char *p;
        unsigned long uid;
 
        if (*line++ != ' ')
@@ -100,8 +100,7 @@ static int dbox_index_parse_maildir(struct dbox_index *index, const char *line,
        if (*p++ != ' ' || *p == '\0' || uid == 0 || uid >= (uint32_t)-1)
                return -1;
 
-       p2 = strstr(p, " :");
-       if (p2 != NULL)
+       if (*p == ':' || strstr(p, " :") != NULL)
                rec->data = p_strdup(index->record_data_pool, line);
        else {
                /* convert to new format */
index 4b513d64b2ddcebea09047b972153710b0bcb29c..846cf1ab025da91dff8700feae510f01c6ad8fa7 100644 (file)
@@ -425,7 +425,8 @@ int dbox_sync_file(struct dbox_sync_context *ctx,
        }
 
        file = dbox_file_init(ctx->mbox, entry->file_id);
-       if (status == DBOX_INDEX_FILE_STATUS_SINGLE_MESSAGE &&
+       if ((status == DBOX_INDEX_FILE_STATUS_SINGLE_MESSAGE ||
+            status == DBOX_INDEX_FILE_STATUS_MAILDIR) &&
            array_is_created(&entry->expunges)) {
                /* fast path to expunging the whole file */
                if (dbox_sync_file_unlink(file) < 0)