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

cras at dovecot.org cras at dovecot.org
Tue Jun 28 02:32:16 EEST 2005


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

Modified Files:
	cmd-append.c 
Log Message:
Yet another APPEND fix.



Index: cmd-append.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-append.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- cmd-append.c	17 Jun 2005 20:30:12 -0000	1.61
+++ cmd-append.c	27 Jun 2005 23:32:14 -0000	1.62
@@ -289,11 +289,11 @@
 	struct client *client = cmd->client;
 	struct cmd_append_context *ctx = cmd->context;
 	size_t size;
-	int failed, all_written;
+	int ret, failed;
 
 	if (ctx->save_ctx != NULL) {
-		if (mailbox_save_continue(ctx->save_ctx) < 0 ||
-		    client->input->closed) {
+		ret = mailbox_save_continue(ctx->save_ctx);
+		if (ret < 0 || client->input->closed) {
 			/* we still have to finish reading the message
 			   from client */
 			mailbox_save_cancel(ctx->save_ctx);
@@ -305,10 +305,10 @@
 		(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;
 	}
 
-	all_written = ctx->input->v_offset == ctx->msg_size;
-	if (all_written || client->input->closed) {
+	if (ret == 0 || client->input->closed) {
 		/* finished */
 		i_stream_unref(ctx->input);
 		ctx->input = NULL;
@@ -317,7 +317,7 @@
 			/* failed above */
 			client_send_storage_error(cmd, ctx->storage);
 			failed = TRUE;
-		} else if (!all_written) {
+		} else if (ret != 0) {
 			/* client disconnected */
 			failed = TRUE;
 			mailbox_save_cancel(ctx->save_ctx);



More information about the dovecot-cvs mailing list