--- sylpheed-1.0.4/src/compose.c.alt-final_newline_fix 2005-06-06 16:40:42 +0400 +++ sylpheed-1.0.4/src/compose.c 2005-06-06 16:41:00 +0400 @@ -2830,7 +2830,7 @@ static gint compose_write_to_file(Compos if ((compose->use_signing && !compose->account->clearsign) || compose->use_encryption) { - if (canonicalize_file_replace(file) < 0) { + if (canonicalize_file_replace(file, TRUE) < 0) { unlink(file); return -1; } @@ -3188,7 +3188,8 @@ static void compose_write_attach(Compose content_type == MIME_TEXT_HTML || content_type == MIME_MESSAGE_RFC822) { tmp_file = get_tmp_file(); - if (canonicalize_file(ainfo->file, tmp_file) < 0) { + if (canonicalize_file(ainfo->file, tmp_file, + FALSE) < 0) { g_free(tmp_file); fclose(attach_fp); continue; --- sylpheed-1.0.4/src/rfc2015.c.alt-final_newline_fix 2005-06-06 16:40:42 +0400 +++ sylpheed-1.0.4/src/rfc2015.c 2005-06-06 16:41:00 +0400 @@ -233,7 +233,7 @@ static void check_signature (MimeInfo *m g_free(tmp_file); goto leave; } - if (canonicalize_file_replace(tmp_file) < 0) { + if (canonicalize_file_replace(tmp_file, FALSE) < 0) { unlink(tmp_file); g_free(tmp_file); goto leave; --- sylpheed-1.0.4/src/utils.c.alt-final_newline_fix 2005-06-06 16:40:42 +0400 +++ sylpheed-1.0.4/src/utils.c 2005-06-06 16:41:00 +0400 @@ -2332,7 +2332,8 @@ gchar *canonicalize_str(const gchar *str return out; } -gint canonicalize_file(const gchar *src, const gchar *dest) +gint canonicalize_file(const gchar *src, const gchar *dest, + gboolean require_final_newline) { FILE *src_fp, *dest_fp; gchar buf[BUFFSIZE]; @@ -2387,7 +2388,7 @@ gint canonicalize_file(const gchar *src, } } - if (last_linebreak == TRUE) { + if (require_final_newline && (last_linebreak == TRUE)) { if (fputs("\r\n", dest_fp) == EOF) err = TRUE; } @@ -2410,13 +2411,14 @@ gint canonicalize_file(const gchar *src, return 0; } -gint canonicalize_file_replace(const gchar *file) +gint canonicalize_file_replace(const gchar *file, + gboolean require_final_newline) { gchar *tmp_file; tmp_file = get_tmp_file(); - if (canonicalize_file(file, tmp_file) < 0) { + if (canonicalize_file(file, tmp_file, require_final_newline) < 0) { g_free(tmp_file); return -1; } --- sylpheed-1.0.4/src/utils.h.alt-final_newline_fix 2005-06-06 16:40:42 +0400 +++ sylpheed-1.0.4/src/utils.h 2005-06-06 16:41:00 +0400 @@ -382,8 +382,10 @@ gint copy_file_part (FILE *fp, gchar *canonicalize_str (const gchar *str); gint canonicalize_file (const gchar *src, - const gchar *dest); -gint canonicalize_file_replace (const gchar *file); + const gchar *dest, + gboolean require_final_newline); +gint canonicalize_file_replace (const gchar *file, + gboolean require_final_newline); gint uncanonicalize_file (const gchar *src, const gchar *dest); gint uncanonicalize_file_replace(const gchar *file);