--- sylpheed-2.2.5/src/rfc2015.c.alt-final_newline_fix 2006-04-12 08:03:01 +0400 +++ sylpheed-2.2.5/src/rfc2015.c 2006-06-04 11:12:19 +0400 @@ -246,7 +246,7 @@ static void check_signature(MimeInfo *mi g_free(tmp_file); goto leave; } - if (canonicalize_file_replace(tmp_file) < 0) { + if (canonicalize_file_replace(tmp_file, FALSE) < 0) { g_unlink(tmp_file); g_free(tmp_file); goto leave; --- sylpheed-2.2.5/src/compose.c.alt-final_newline_fix 2006-04-12 08:03:01 +0400 +++ sylpheed-2.2.5/src/compose.c 2006-06-04 11:14:16 +0400 @@ -3107,7 +3107,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) { g_unlink(file); return -1; } @@ -3513,7 +3513,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; @@ -5491,7 +5492,7 @@ static void compose_exec_ext_editor(Comp return; } #ifdef G_OS_WIN32 - if (canonicalize_file_replace(tmp) < 0) { + if (canonicalize_file_replace(tmp, TRUE) < 0) { g_warning("Coundn't write to file: %s\n", tmp); g_free(tmp); return; --- sylpheed-2.2.5/libsylph/utils.c.alt-final_newline_fix 2006-06-04 11:01:21 +0400 +++ sylpheed-2.2.5/libsylph/utils.c 2006-06-04 11:07:11 +0400 @@ -2660,7 +2660,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]; @@ -2715,7 +2716,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; } @@ -2738,13 +2739,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-2.2.5/libsylph/procmsg.c.alt-final_newline_fix 2006-04-12 08:03:01 +0400 +++ sylpheed-2.2.5/libsylph/procmsg.c 2006-06-04 11:15:07 +0400 @@ -1365,7 +1365,7 @@ void procmsg_print_message(MsgInfo *msgi fclose(tmpfp); #ifdef G_OS_WIN32 - if (canonicalize_file_replace(prtmp) < 0) { + if (canonicalize_file_replace(prtmp, TRUE) < 0) { g_free(prtmp); return; } --- sylpheed-2.2.5/libsylph/utils.h.alt-final_newline_fix 2006-06-04 11:01:21 +0400 +++ sylpheed-2.2.5/libsylph/utils.h 2006-06-04 11:09:45 +0400 @@ -426,8 +426,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); FILE *canonicalize_file_stream (FILE *fp, gint *length); gint uncanonicalize_file (const gchar *src,