Kill another mktemp
authorJulien Danjou <julien@danjou.info>
Sat, 25 Nov 2006 17:10:51 +0000 (18:10 +0100)
committerPierre Habouzit <madcoder@debian.org>
Sun, 26 Nov 2006 16:11:29 +0000 (17:11 +0100)
Signed-off-by: Julien Danjou <julien@danjou.info>
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
main.c

diff --git a/main.c b/main.c
index b3d7e66..9e2ef37 100644 (file)
--- a/main.c
+++ b/main.c
@@ -672,6 +672,7 @@ int main (int argc, char **argv)
     char buf[LONG_STRING];
     char *tempfile = NULL, *infile = NULL;
     char *bodytext = NULL;
     char buf[LONG_STRING];
     char *tempfile = NULL, *infile = NULL;
     char *bodytext = NULL;
+    FILE *fout;
 
     if (!option (OPTNOCURSES))
       mutt_flushinp ();
 
     if (!option (OPTNOCURSES))
       mutt_flushinp ();
@@ -726,18 +727,16 @@ int main (int argc, char **argv)
       else
         fin = NULL;
 
       else
         fin = NULL;
 
-      mutt_mktemp (buf);
-      tempfile = m_strdup(buf);
-
       if (draftFile)
         msg->env = mutt_read_rfc822_header (fin, NULL, 1, 0);
 
       /* is the following if still needed? */
 
       if (draftFile)
         msg->env = mutt_read_rfc822_header (fin, NULL, 1, 0);
 
       /* is the following if still needed? */
 
-      if (tempfile) {
-        FILE *fout;
+      fout = m_tempfile(buf, sizeof(buf), NONULL(Tempdir), NULL);
+      tempfile = m_strdup(buf);
 
 
-        if ((fout = safe_fopen (tempfile, "w")) == NULL) {
+      if (tempfile) {
+        if (!fout) {
           if (!option (OPTNOCURSES))
             mutt_endwin (NULL);
           perror (tempfile);
           if (!option (OPTNOCURSES))
             mutt_endwin (NULL);
           perror (tempfile);