]> diplodocus.org Git - nmh/blobdiff - uip/mhfixmsg.c
Tweaked check of -outfile in test-mhstore.
[nmh] / uip / mhfixmsg.c
index 10a8e1b3f1310a5057dbf9dac00e4ecd073c4c80..8c5268ef93680a3cfabff69f6cefc01b0515511c 100644 (file)
@@ -11,9 +11,6 @@
 #include <h/mhparse.h>
 #include <h/utils.h>
 #include <h/signals.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
 #include <fcntl.h>
 #ifdef HAVE_ICONV
 #   include <iconv.h>
@@ -458,6 +455,7 @@ mhfixmsgsbr (CT *ctp, const fix_transformations *fx, char *outfile) {
     }
 
     if (modify_inplace) {
+        if (status != OK) unlink (outfile);
         free (outfile);
         outfile = NULL;
     }
@@ -612,7 +610,7 @@ get_multipart_boundary (CT ct, char **part_boundary) {
             }
         }
     } else {
-       status = NOTOK;
+        status = NOTOK;
     }
 
     if (status == OK) {
@@ -951,7 +949,11 @@ ensure_text_plain (CT *ct, CT parent, int *message_mods) {
                         free_content (mp_alt);
                         status = NOTOK;
                     }
+                } else {
+                    status = NOTOK;
                 }
+            } else {
+                status = NOTOK;
             }
         }
         break;
@@ -1450,6 +1452,8 @@ decode_text_parts (CT ct, int encoding, int *message_mods) {
             if (decode_part (ct) == OK  &&  ct->c_cefile.ce_file) {
                 if ((ct_encoding = content_encoding (ct)) == CE_BINARY  &&
                     encoding != CE_BINARY) {
+                    /* The decoding isn't acceptable so discard it.
+                       Leave status as OK to allow other transformations. */
                     if (verbosw) {
                         report (ct->c_partno, ct->c_file,
                                 "will not decode%s because it is binary",
@@ -1460,8 +1464,10 @@ 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;
-                } else if (ct->c_encoding == CE_QUOTED &&
+                } else if (ct->c_encoding == CE_QUOTED  &&
                            ct_encoding == CE_8BIT  &&  encoding == CE_7BIT) {
+                    /* The decoding isn't acceptable so discard it.
+                       Leave status as OK to allow other transformations. */
                     if (verbosw) {
                         report (ct->c_partno, ct->c_file,
                                 "will not decode%s because it is 8bit",
@@ -1828,6 +1834,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. */