[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-save.c, 1.88, 1.89

cras at dovecot.org cras at dovecot.org
Sun Oct 16 18:07:02 EEST 2005


Update of /var/lib/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv6463/lib-storage/index/mbox

Modified Files:
	mbox-save.c 
Log Message:
Instead of crashing when trying to copy mails within same mailbox, give an
error message to user.



Index: mbox-save.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-save.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -d -r1.88 -r1.89
--- mbox-save.c	28 Aug 2005 21:28:59 -0000	1.88
+++ mbox-save.c	16 Oct 2005 15:07:00 -0000	1.89
@@ -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;
 		}



More information about the dovecot-cvs mailing list