]> diplodocus.org Git - nmh/blobdiff - uip/mhparse.c
mhl() needs to set invo_name, too.
[nmh] / uip / mhparse.c
index 9489a8e4c01840ac64bb3c8dc459998954ecd0e7..716a22f73144de4b8436883d9cfe87c9d2c41459 100644 (file)
@@ -205,12 +205,12 @@ parse_mime (char *file)
        fflush (fp);
 
        if (ferror (stdin)) {
        fflush (fp);
 
        if (ferror (stdin)) {
-           unlink (file);
+           (void) m_unlink (file);
            advise ("stdin", "error reading");
            return NULL;
        }
        if (ferror (fp)) {
            advise ("stdin", "error reading");
            return NULL;
        }
        if (ferror (fp)) {
-           unlink (file);
+           (void) m_unlink (file);
            advise (file, "error writing");
            return NULL;
        }
            advise (file, "error writing");
            return NULL;
        }
@@ -222,7 +222,7 @@ parse_mime (char *file)
 
     if (!(ct = get_content (fp, file, 1))) {
        if (is_stdin)
 
     if (!(ct = get_content (fp, file, 1))) {
        if (is_stdin)
-           unlink (file);
+           (void) m_unlink (file);
        advise (NULL, "unable to decode %s", file);
        return NULL;
     }
        advise (NULL, "unable to decode %s", file);
        return NULL;
     }
@@ -1669,17 +1669,7 @@ openBase64 (CT ct, char **file)
         cp = context_find (buffer);
     }
     if (cp != NULL && *cp != '\0') {
         cp = context_find (buffer);
     }
     if (cp != NULL && *cp != '\0') {
-        if (ce->ce_unlink) {
-            /* Temporary file already exists, so we rename to
-               version with extension. */
-            char *file_org = strdup(ce->ce_file);
-            ce->ce_file = add (cp, ce->ce_file);
-            if (rename(file_org, ce->ce_file)) {
-                adios (ce->ce_file, "unable to rename %s to ", file_org);
-            }
-            free(file_org);
-
-        } else {
+        if (! ce->ce_unlink) {
             ce->ce_file = add (cp, ce->ce_file);
         }
     }
             ce->ce_file = add (cp, ce->ce_file);
         }
     }
@@ -1908,17 +1898,7 @@ openQuoted (CT ct, char **file)
         cp = context_find (buffer);
     }
     if (cp != NULL && *cp != '\0') {
         cp = context_find (buffer);
     }
     if (cp != NULL && *cp != '\0') {
-        if (ce->ce_unlink) {
-            /* Temporary file already exists, so we rename to
-               version with extension. */
-            char *file_org = strdup(ce->ce_file);
-            ce->ce_file = add (cp, ce->ce_file);
-            if (rename(file_org, ce->ce_file)) {
-                adios (ce->ce_file, "unable to rename %s to ", file_org);
-            }
-            free(file_org);
-
-        } else {
+        if (! ce->ce_unlink) {
             ce->ce_file = add (cp, ce->ce_file);
         }
     }
             ce->ce_file = add (cp, ce->ce_file);
         }
     }
@@ -2137,17 +2117,7 @@ open7Bit (CT ct, char **file)
         cp = context_find (buffer);
     }
     if (cp != NULL && *cp != '\0') {
         cp = context_find (buffer);
     }
     if (cp != NULL && *cp != '\0') {
-        if (ce->ce_unlink) {
-            /* Temporary file already exists, so we rename to
-               version with extension. */
-            char *file_org = strdup(ce->ce_file);
-            ce->ce_file = add (cp, ce->ce_file);
-            if (rename(file_org, ce->ce_file)) {
-                adios (ce->ce_file, "unable to rename %s to ", file_org);
-            }
-            free(file_org);
-
-        } else {
+        if (! ce->ce_unlink) {
             ce->ce_file = add (cp, ce->ce_file);
         }
     }
             ce->ce_file = add (cp, ce->ce_file);
         }
     }
@@ -2370,12 +2340,12 @@ openFile (CT ct, char **file)
 
            if (ferror (gp)) {
                admonish (ce->ce_file, "error reading");
 
            if (ferror (gp)) {
                admonish (ce->ce_file, "error reading");
-               unlink (cachefile);
+               (void) m_unlink (cachefile);
            }
            else
                if (ferror (fp)) {
                    admonish (cachefile, "error writing");
            }
            else
                if (ferror (fp)) {
                    admonish (cachefile, "error writing");
-                   unlink (cachefile);
+                   (void) m_unlink (cachefile);
                }
            fclose (fp);
        }
                }
            fclose (fp);
        }
@@ -2586,12 +2556,12 @@ openFTP (CT ct, char **file)
 
                if (ferror (gp)) {
                    admonish (ce->ce_file, "error reading");
 
                if (ferror (gp)) {
                    admonish (ce->ce_file, "error reading");
-                   unlink (cachefile);
+                   (void) m_unlink (cachefile);
                }
                else
                    if (ferror (fp)) {
                        admonish (cachefile, "error writing");
                }
                else
                    if (ferror (fp)) {
                        admonish (cachefile, "error writing");
-                       unlink (cachefile);
+                       (void) m_unlink (cachefile);
                    }
                fclose (fp);
            }
                    }
                fclose (fp);
            }
@@ -2861,7 +2831,7 @@ openURL (CT ct, char **file)
 
                if (ferror(gp)) {
                    admonish(ce->ce_file, "error reading");
 
                if (ferror(gp)) {
                    admonish(ce->ce_file, "error reading");
-                   unlink(cachefile);
+                   (void) m_unlink (cachefile);
                }
            }
            umask(mask);
                }
            }
            umask(mask);