From: David Levine Date: Thu, 4 Apr 2013 00:56:54 +0000 (-0500) Subject: Be sure that mhfixmsg returns a status of non-zero if X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/ebf35185aa9256b0cd09234f39bd14db9e90e81c?hp=71decbbc7b32f17449aa88c0297263c3ab324780 Be sure that mhfixmsg returns a status of non-zero if it can't reformat a part. --- diff --git a/test/mhfixmsg/test-mhfixmsg b/test/mhfixmsg/test-mhfixmsg index 709a4062..5ac77ca5 100755 --- a/test/mhfixmsg/test-mhfixmsg +++ b/test/mhfixmsg/test-mhfixmsg @@ -557,7 +557,9 @@ Db2yPbwK EOF cp -p `mhpath last` "$expected" +set +e mhfixmsg last +set -e check `mhpath last` "$expected" 'keep first' @@ -628,13 +630,12 @@ mhfixmsg last -textcodeset utf-8 -outfile "$actual" 2>"$actual.err" if grep "mhfixmsg: Can't convert .* to .* without iconv" "$actual.err" \ >/dev/null; then echo skipping -textcodeset check because nmh was built without iconv - set +e rm -f "$expected" "$actual" "$actual.err" else - set +e check "$expected" "$actual" rm "$actual.err" fi +set -e # check -nofixboundary diff --git a/uip/mhfixmsg.c b/uip/mhfixmsg.c index 9e672b44..c839b246 100644 --- a/uip/mhfixmsg.c +++ b/uip/mhfixmsg.c @@ -456,6 +456,7 @@ mhfixmsgsbr (CT *ctp, const fix_transformations *fx, char *outfile) { } if (modify_inplace) { + if (status != OK) unlink (outfile); free (outfile); outfile = NULL; } @@ -949,7 +950,11 @@ ensure_text_plain (CT *ct, CT parent, int *message_mods) { free_content (mp_alt); status = NOTOK; } + } else { + status = NOTOK; } + } else { + status = NOTOK; } } break; @@ -1458,6 +1463,7 @@ decode_text_parts (CT ct, int encoding, int *message_mods) { unlink (ct->c_cefile.ce_file); free (ct->c_cefile.ce_file); ct->c_cefile.ce_file = NULL; + status = NOTOK; } else if (ct->c_encoding == CE_QUOTED && ct_encoding == CE_8BIT && encoding == CE_7BIT) { if (verbosw) { @@ -1470,6 +1476,7 @@ decode_text_parts (CT ct, int encoding, int *message_mods) { unlink (ct->c_cefile.ce_file); free (ct->c_cefile.ce_file); ct->c_cefile.ce_file = NULL; + status = NOTOK; } else { int enc; if (ct_encoding == CE_BINARY) @@ -1826,6 +1833,8 @@ write_content (CT ct, char *input_filename, char *outfile, int modify_inplace, } free (infile); + } else { + status = NOTOK; } } else { /* No modifications and didn't need the tmp outfile. */