aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-06-14 13:10:58 +0800
committerDan Winship <danw@src.gnome.org>2000-06-14 13:10:58 +0800
commitf6bfa59574deffabf0067c3741d35cd2238daaf2 (patch)
treeb28dfe5882c6fb0ff8243adc729fe9be8c6c8910
parentabdfcfcfe2f4fb79a05bd0e2def3d65a668e96ae (diff)
downloadgsoc2013-evolution-f6bfa59574deffabf0067c3741d35cd2238daaf2.tar
gsoc2013-evolution-f6bfa59574deffabf0067c3741d35cd2238daaf2.tar.gz
gsoc2013-evolution-f6bfa59574deffabf0067c3741d35cd2238daaf2.tar.bz2
gsoc2013-evolution-f6bfa59574deffabf0067c3741d35cd2238daaf2.tar.lz
gsoc2013-evolution-f6bfa59574deffabf0067c3741d35cd2238daaf2.tar.xz
gsoc2013-evolution-f6bfa59574deffabf0067c3741d35cd2238daaf2.tar.zst
gsoc2013-evolution-f6bfa59574deffabf0067c3741d35cd2238daaf2.zip
if the mbox doesn't end with a '\n', write one before appending the new
* providers/mbox/camel-mbox-folder.c (mbox_append_message): if the mbox doesn't end with a '\n', write one before appending the new message. svn path=/trunk/; revision=3562
-rw-r--r--camel/ChangeLog6
-rw-r--r--camel/providers/mbox/camel-mbox-folder.c16
2 files changed, 18 insertions, 4 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index d5e69538e3..533f243df5 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,9 @@
+2000-06-14 Dan Winship <danw@helixcode.com>
+
+ * providers/mbox/camel-mbox-folder.c (mbox_append_message): if the
+ mbox doesn't end with a '\n', write one before appending the new
+ message.
+
2000-06-14 Jeffrey Stedfast <fejj@helixcode.com>
* camel-mime-filter-crlf.c (filter): Updated the encoder to allocate more
diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c
index 5f8e4a90c8..035dbee127 100644
--- a/camel/providers/mbox/camel-mbox-folder.c
+++ b/camel/providers/mbox/camel-mbox-folder.c
@@ -299,7 +299,7 @@ mbox_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelExcept
CamelMimeFilter *filter_from = NULL;
struct stat st;
off_t seek = -1;
- char *xev;
+ char *xev, last;
guint32 uid;
if (stat(mbox_folder->folder_file_path, &st) != 0)
@@ -309,9 +309,17 @@ mbox_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelExcept
if (output_stream == NULL)
goto fail;
- seek = camel_seekable_stream_seek((CamelSeekableStream *)output_stream, st.st_size, SEEK_SET);
- if (seek != st.st_size)
- goto fail;
+ if (st.st_size) {
+ seek = camel_seekable_stream_seek((CamelSeekableStream *)output_stream, st.st_size - 1, SEEK_SET);
+ if (seek != st.st_size - 1)
+ goto fail;
+
+ /* If the mbox doesn't end with a newline, fix that. */
+ if (camel_stream_read (output_stream, &last, 1) != 1)
+ goto fail;
+ if (last != '\n')
+ camel_stream_write (output_stream, "\n", 1);
+ }
/* assign a new x-evolution header/uid */
camel_medium_remove_header((CamelMedium *)message, "X-Evolution");