changeset 3662:247501e81026 HEAD

Instead of crashing when trying to copy mails within same mailbox, give an error message to user.
author Timo Sirainen <tss@iki.fi>
date Sun, 16 Oct 2005 18:07:00 +0300
parents a745511d591e
children 6d485bf73429
files src/lib-storage/index/mbox/mbox-save.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-save.c	Sun Oct 16 17:59:12 2005 +0300
+++ b/src/lib-storage/index/mbox/mbox-save.c	Sun Oct 16 18:07:00 2005 +0300
@@ -277,7 +277,15 @@
 	if (ctx->append_offset == (uoff_t)-1) {
 		/* first appended mail in this transaction */
 		if (mbox->mbox_lock_type != F_WRLCK) {
-			i_assert(mbox->mbox_lock_type != F_RDLCK);
+			if (mbox->mbox_lock_type == F_RDLCK) {
+				/* FIXME: we shouldn't fail here. it's just
+				   a locking issue that should be possible to
+				   fix.. */
+				mail_storage_set_error(
+					STORAGE(ctx->mbox->storage),
+					"Can't copy mails inside same mailbox");
+				return -1;
+			}
 			if (mbox_lock(mbox, F_WRLCK, &t->mbox_lock_id) <= 0)
 				return -1;
 		}