[dovecot-cvs] dovecot/src/imap imap-fetch-body.c, 1.28.2.2, 1.28.2.3

tss at dovecot.org tss at dovecot.org
Sun Mar 11 01:47:04 EET 2007


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

Modified Files:
      Tag: branch_1_0
	imap-fetch-body.c 
Log Message:
If mail was in CR+LF format in the disk and we used sendfile() call, but the
call couldn't send everything, we hanged.



Index: imap-fetch-body.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/imap-fetch-body.c,v
retrieving revision 1.28.2.2
retrieving revision 1.28.2.3
diff -u -d -r1.28.2.2 -r1.28.2.3
--- imap-fetch-body.c	25 Jan 2007 15:59:23 -0000	1.28.2.2
+++ imap-fetch-body.c	10 Mar 2007 23:47:02 -0000	1.28.2.3
@@ -253,18 +253,23 @@
 		ctx->cur_append_eoh = FALSE;
 	}
 
-	if (ctx->cur_offset != ctx->cur_size &&
-	    !i_stream_have_bytes_left(ctx->cur_input)) {
-		/* Input stream gave less data than expected */
-		i_error("FETCH for mailbox %s UID %u got too little data: "
-			"%"PRIuUOFF_T" vs %"PRIuUOFF_T,
-			mailbox_get_name(ctx->mail->box), ctx->mail->uid,
-			ctx->cur_offset, ctx->cur_size);
-		o_stream_close(ctx->client->output);
-		return -1;
-	}
+	if (ctx->cur_offset != ctx->cur_size) {
+		/* unfinished */
+		if (!i_stream_have_bytes_left(ctx->cur_input)) {
+			/* Input stream gave less data than expected */
+			i_error("FETCH for mailbox %s UID %u "
+				"got too little data: "
+				"%"PRIuUOFF_T" vs %"PRIuUOFF_T,
+				mailbox_get_name(ctx->mail->box),
+				ctx->mail->uid, ctx->cur_offset, ctx->cur_size);
+			o_stream_close(ctx->client->output);
+			return -1;
+		}
 
-	return ctx->cur_offset == ctx->cur_size;
+		o_stream_set_flush_pending(ctx->client->output, TRUE);
+		return 0;
+	}
+	return 1;
 }
 
 static int fetch_stream(struct imap_fetch_context *ctx,



More information about the dovecot-cvs mailing list