[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-save.c, 1.95,
1.96
cras at dovecot.org
cras at dovecot.org
Sat Jun 17 21:00:39 EEST 2006
Update of /var/lib/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv22403
Modified Files:
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.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- mbox-save.c 9 May 2006 11:57:39 -0000 1.95
+++ mbox-save.c 17 Jun 2006 18:00:35 -0000 1.96
@@ -456,9 +456,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