remove some mutt_mktemp
[apps/madmutt.git] / imap / imap.c
index a180ac1..c214ddf 100644 (file)
@@ -347,9 +347,9 @@ IMAP_DATA *imap_conn_find (const ACCOUNT * account, int flags)
   if (idata->state == IMAP_CONNECTED) {
     if (!imap_authenticate (idata)) {
       idata->state = IMAP_AUTHENTICATED;
-    }
-    else
+    } else {
       mutt_account_unsetpass (&idata->conn->account);
+    }
 
     p_delete(&idata->capstr);
   }
@@ -1598,15 +1598,16 @@ static int imap_open_new_message (MESSAGE * msg,
                                   CONTEXT * dest __attribute__ ((unused)),
                                   HEADER * hdr __attribute__ ((unused)))
 {
-  char tmp[_POSIX_PATH_MAX];
+    char tmp[_POSIX_PATH_MAX];
 
-  mutt_mktemp (tmp);
-  if ((msg->fp = safe_fopen (tmp, "w")) == NULL) {
-    mutt_perror (tmp);
-    return (-1);
-  }
-  msg->path = m_strdup(tmp);
-  return 0;
+    msg->fp = m_tempfile(tmp, sizeof(tmp), NONULL(Tempdir), NULL);
+    if (!msg->fp) {
+        mutt_perror(tmp);
+        return -1;
+    }
+
+    msg->path = m_strdup(tmp);
+    return 0;
 }
 
 /* this ugly kludge is required since the last int to