Mercurial > dovecot > core-2.2
changeset 5533:e607f517d08b HEAD
Create destination storage before locking home directory, so home dir is
created if it doesn't yet exist.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 10 Apr 2007 17:14:58 +0300 |
parents | b8dd889066ca |
children | c69786bd2017 |
files | src/plugins/convert/convert-storage.c |
diffstat | 1 files changed, 17 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/convert/convert-storage.c Sat Apr 07 14:09:36 2007 +0300 +++ b/src/plugins/convert/convert-storage.c Tue Apr 10 17:14:58 2007 +0300 @@ -270,6 +270,18 @@ return 0; } + /* If home directory doesn't exist, creating the destination storage + will most likely create it. So do this before locking. */ + dest_ns = mail_namespaces_init_empty(pool_datastack_create()); + if (mail_storage_create(dest_ns, NULL, dest_data, user, + dest_flags, lock_method) < 0) { + i_error("Mailbox conversion: Failed to create destination " + "storage with data: %s", dest_data); + mail_namespaces_deinit(&dest_ns); + mail_namespaces_deinit(&source_ns); + return -1; + } + path = t_strconcat(home_dir, "/"CONVERT_LOCK_FILENAME, NULL); dotlock_settings.use_excl_lock = (source_ns->storage->flags & @@ -291,19 +303,11 @@ return 0; } - dest_ns = mail_namespaces_init_empty(pool_datastack_create()); - if (mail_storage_create(dest_ns, NULL, dest_data, user, - dest_flags, lock_method) < 0) { - i_error("Mailbox conversion: Failed to create destination " - "storage with data: %s", dest_data); - ret = -1; - } else { - ret = mailbox_list_copy(source_ns->storage, dest_ns->storage, - dotlock, skip_broken_mailboxes); - if (ret == 0) { - ret = mailbox_list_copy_subscriptions( - source_ns->storage, dest_ns->storage); - } + ret = mailbox_list_copy(source_ns->storage, dest_ns->storage, + dotlock, skip_broken_mailboxes); + if (ret == 0) { + ret = mailbox_list_copy_subscriptions(source_ns->storage, + dest_ns->storage); } if (ret == 0) {