Mercurial > dovecot > core-2.2
changeset 10734:8d5e2deb4ce0 HEAD
dsync: Don't try to change INBOX's GUID.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 15 Feb 2010 07:09:12 +0200 |
parents | 1afcc09c2c6c |
children | 6247eb25fd1a |
files | src/dsync/dsync-worker-local.c |
diffstat | 1 files changed, 19 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/src/dsync/dsync-worker-local.c Mon Feb 15 07:08:40 2010 +0200 +++ b/src/dsync/dsync-worker-local.c Mon Feb 15 07:09:12 2010 +0200 @@ -1035,33 +1035,31 @@ struct mailbox_update update; const char *errstr; enum mail_error error; - int ret; local_worker_copy_mailbox_update(dsync_box, &update); - ret = mailbox_create(box, &update, dsync_box->uid_validity == 0); - if (ret < 0 && strcasecmp(mailbox_get_name(box), "INBOX") == 0) - ret = mailbox_update(box, &update); - errstr = mail_storage_get_last_error(mailbox_get_storage(box), &error); - if (ret < 0 && error == MAIL_ERROR_EXISTS) { - /* mailbox already exists */ - if (dsync_box->uid_validity != 0) + if (mailbox_create(box, &update, dsync_box->uid_validity == 0) < 0) { + errstr = mail_storage_get_last_error(mailbox_get_storage(box), + &error); + if (error == MAIL_ERROR_EXISTS) { + /* mailbox already exists */ + if (dsync_box->uid_validity == 0) { + /* just a directory - no one cares */ + return 1; + } return 0; - else { - /* just a directory - no one cares */ - return 1; } - } - if (ret < 0) { + dsync_worker_set_failure(&worker->worker); i_error("Can't create mailbox %s: %s", dsync_box->name, errstr); - } else { - local_dsync_worker_add_mailbox(worker, - mailbox_get_namespace(box), - mailbox_get_name(box), - &dsync_box->mailbox_guid); + return -1; } - return ret < 0 ? -1 : 1; + + local_dsync_worker_add_mailbox(worker, + mailbox_get_namespace(box), + mailbox_get_name(box), + &dsync_box->mailbox_guid); + return 1; } static void @@ -1115,7 +1113,7 @@ lbox = hash_table_lookup(worker->mailbox_hash, mailbox); if (lbox == NULL) { i_error("Trying to delete a non-listed mailbox with guid=%s", - binary_to_hex(mailbox->guid, sizeof(mailbox->guid))); + dsync_guid_to_str(mailbox)); dsync_worker_set_failure(_worker); return; } @@ -1149,7 +1147,7 @@ lbox = hash_table_lookup(worker->mailbox_hash, mailbox); if (lbox == NULL) { i_error("Trying to rename a non-listed mailbox with guid=%s", - binary_to_hex(mailbox->guid, sizeof(mailbox->guid))); + dsync_guid_to_str(mailbox)); dsync_worker_set_failure(_worker); return; }