remove some mutt_mktemp
[apps/madmutt.git] / imap / message.c
index 930f4d3..6c1fce7 100644 (file)
@@ -83,13 +83,13 @@ int imap_read_headers (IMAP_DATA * idata, int msgbegin, int msgend)
 
   /* instead of downloading all headers and then parsing them, we parse them
    * as they come in. */
 
   /* instead of downloading all headers and then parsing them, we parse them
    * as they come in. */
-  mutt_mktemp (tempfile);
-  if (!(fp = safe_fopen (tempfile, "w+"))) {
-    mutt_error (_("Could not create temporary file %s"), tempfile);
-    mutt_sleep (2);
+  fp = m_tempfile(tempfile, sizeof(tempfile), NONULL(Tempdir), NULL);
+  if (!fp) {
+    mutt_error(_("Could not create temporary file"));
+    mutt_sleep(2);
     return -1;
   }
     return -1;
   }
-  unlink (tempfile);
+  unlink(tempfile);
 
   /* make sure context has room to hold the mailbox */
   while ((msgend) >= idata->ctx->hdrmax)
 
   /* make sure context has room to hold the mailbox */
   while ((msgend) >= idata->ctx->hdrmax)
@@ -376,12 +376,11 @@ int imap_fetch_message (MESSAGE * msg, CONTEXT * ctx, int msgno)
     mutt_message _("Fetching message...");
 
   cache->uid = HEADER_DATA (h)->uid;
     mutt_message _("Fetching message...");
 
   cache->uid = HEADER_DATA (h)->uid;
-  mutt_mktemp (path);
-  cache->path = m_strdup(path);
-  if (!(msg->fp = safe_fopen (path, "w+"))) {
-    p_delete(&cache->path);
+  msg->fp = m_tempfile(path, sizeof(path), NONULL(Tempdir), NULL);
+  if (!msg->fp) {
     return -1;
   }
     return -1;
   }
+  cache->path = m_strdup(path);
 
   /* mark this header as currently inactive so the command handler won't
    * also try to update it. HACK until all this code can be moved into the
 
   /* mark this header as currently inactive so the command handler won't
    * also try to update it. HACK until all this code can be moved into the