[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-save.c, 1.94,
1.94.2.1
cras at dovecot.org
cras at dovecot.org
Sat Jun 17 21:00:36 EEST 2006
Update of /var/lib/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv3408
Modified Files:
Tag: branch_1_0
mbox-save.c
Log Message:
If saved mail's body doesn't end with LF, add it ourself.
Index: mbox-save.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-save.c,v
retrieving revision 1.94
retrieving revision 1.94.2.1
diff -u -d -r1.94 -r1.94.2.1
--- mbox-save.c 14 Apr 2006 11:14:08 -0000 1.94
+++ mbox-save.c 17 Jun 2006 18:00:34 -0000 1.94.2.1
@@ -452,9 +452,28 @@
if (ctx->eoh_offset != (uoff_t)-1) {
/* writing body */
- if (o_stream_send_istream(ctx->body_output, ctx->input) < 0) {
- write_error(ctx, ctx->body_output->stream_errno);
- return -1;
+ while ((ret = i_stream_read(ctx->input)) != -1) {
+ if (ret == 0)
+ return 0;
+
+ data = i_stream_get_data(ctx->input, &size);
+ if (o_stream_send(ctx->output, data, size) < 0) {
+ write_error(ctx, ctx->output->stream_errno);
+ return -1;
+ }
+ ctx->last_char = data[size-1];
+ i_stream_skip(ctx->input, size);
+ }
+
+ if (ctx->last_char != '\n') {
+ /* if mail doesn't end with LF, we'll do that.
+ otherwise some mbox parsers don't like the result.
+ this makes it impossible to save a mail that doesn't
+ end with LF though. */
+ if (o_stream_send(ctx->output, "\n", 1) < 0) {
+ write_error(ctx, ctx->output->stream_errno);
+ return -1;
+ }
}
return 0;
}
More information about the dovecot-cvs
mailing list