]> diplodocus.org Git - nmh/commitdiff
Be sure that mhfixmsg returns a status of non-zero if
authorDavid Levine <levinedl@acm.org>
Thu, 4 Apr 2013 00:56:54 +0000 (19:56 -0500)
committerDavid Levine <levinedl@acm.org>
Thu, 4 Apr 2013 00:56:54 +0000 (19:56 -0500)
it can't reformat a part.

test/mhfixmsg/test-mhfixmsg
uip/mhfixmsg.c

index 709a4062f2da28d17e3cc8a859242e3cb6a5100d..5ac77ca5e6e0ebefcdea4dbc27a6ced6dd5e6230 100755 (executable)
@@ -557,7 +557,9 @@ Db2yPbwK
 EOF
 
 cp -p `mhpath last` "$expected"
 EOF
 
 cp -p `mhpath last` "$expected"
+set +e
 mhfixmsg last
 mhfixmsg last
+set -e
 check `mhpath last` "$expected" 'keep first'
 
 
 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
 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
   rm -f "$expected" "$actual" "$actual.err"
 else
-  set +e
   check "$expected" "$actual"
   rm "$actual.err"
 fi
   check "$expected" "$actual"
   rm "$actual.err"
 fi
+set -e
 
 
 # check -nofixboundary
 
 
 # check -nofixboundary
index 9e672b44bcb3b22c6e89893100e10dbab7d5ee74..c839b2469ab2a3295cb78e3380e2b7c1de78ff30 100644 (file)
@@ -456,6 +456,7 @@ mhfixmsgsbr (CT *ctp, const fix_transformations *fx, char *outfile) {
     }
 
     if (modify_inplace) {
     }
 
     if (modify_inplace) {
+        if (status != OK) unlink (outfile);
         free (outfile);
         outfile = NULL;
     }
         free (outfile);
         outfile = NULL;
     }
@@ -949,7 +950,11 @@ ensure_text_plain (CT *ct, CT parent, int *message_mods) {
                         free_content (mp_alt);
                         status = NOTOK;
                     }
                         free_content (mp_alt);
                         status = NOTOK;
                     }
+                } else {
+                    status = NOTOK;
                 }
                 }
+            } else {
+                status = NOTOK;
             }
         }
         break;
             }
         }
         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;
                     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) {
                 } 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;
                     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)
                 } 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);
                 }
 
                 free (infile);
+            } else {
+                status = NOTOK;
             }
         } else {
             /* No modifications and didn't need the tmp outfile. */
             }
         } else {
             /* No modifications and didn't need the tmp outfile. */