[dovecot-cvs] dovecot/src/imap cmd-append.c,1.62,1.63

cras at dovecot.org cras at dovecot.org
Tue Jun 28 14:13:58 EEST 2005


Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv31402

Modified Files:
	cmd-append.c 
Log Message:
Yet another try at fixing APPEND.



Index: cmd-append.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-append.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- cmd-append.c	27 Jun 2005 23:32:14 -0000	1.62
+++ cmd-append.c	28 Jun 2005 11:13:56 -0000	1.63
@@ -289,11 +289,11 @@
 	struct client *client = cmd->client;
 	struct cmd_append_context *ctx = cmd->context;
 	size_t size;
-	int ret, failed;
+	int failed;
 
 	if (ctx->save_ctx != NULL) {
-		ret = mailbox_save_continue(ctx->save_ctx);
-		if (ret < 0 || client->input->closed) {
+		if (mailbox_save_continue(ctx->save_ctx) < 0 ||
+		    client->input->closed) {
 			/* we still have to finish reading the message
 			   from client */
 			mailbox_save_cancel(ctx->save_ctx);
@@ -305,10 +305,9 @@
 		(void)i_stream_read(ctx->input);
 		(void)i_stream_get_data(ctx->input, &size);
 		i_stream_skip(ctx->input, size);
-		ret = size == 0 ? 0 : 1;
 	}
 
-	if (ret == 0 || client->input->closed) {
+	if (ctx->input->eof || client->input->closed) {
 		/* finished */
 		i_stream_unref(ctx->input);
 		ctx->input = NULL;
@@ -317,8 +316,9 @@
 			/* failed above */
 			client_send_storage_error(cmd, ctx->storage);
 			failed = TRUE;
-		} else if (ret != 0) {
-			/* client disconnected */
+		} else if (ctx->input->v_offset != ctx->msg_size) {
+			/* client disconnected before it finished sending the
+			   whole message. */
 			failed = TRUE;
 			mailbox_save_cancel(ctx->save_ctx);
 		} else if (mailbox_save_finish(ctx->save_ctx, NULL) < 0) {



More information about the dovecot-cvs mailing list