[dovecot-cvs] dovecot/src/plugins/convert convert-storage.c, 1.19, 1.20
tss at dovecot.org
tss at dovecot.org
Tue Apr 10 17:15:01 EEST 2007
Update of /var/lib/cvs/dovecot/src/plugins/convert
In directory talvi:/tmp/cvs-serv15399
Modified Files:
convert-storage.c
Log Message:
Create destination storage before locking home directory, so home dir is
created if it doesn't yet exist.
Index: convert-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/convert/convert-storage.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- convert-storage.c 7 Apr 2007 08:07:52 -0000 1.19
+++ convert-storage.c 10 Apr 2007 14:14:58 -0000 1.20
@@ -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) {
More information about the dovecot-cvs
mailing list