fclose -> m_fclose
[apps/madmutt.git] / lib-mime / rfc3676.c
index 404b02b..68bf1f5 100644 (file)
@@ -224,20 +224,21 @@ void rfc3676_space_stuff (HEADER* hdr) {
 
   if ((in = safe_fopen (hdr->content->filename, "r")) == NULL)
     return;
-  mutt_mktemp (tmpf);
-  if ((out = safe_fopen (tmpf, "w+")) == NULL) {
-    fclose (in);
+
+  out = m_tempfile(tmpf, sizeof(tmpf), NONULL(Tempdir), NULL);
+  if (!out) {
+    m_fclose(&in);
     return;
   }
 
-  while (fgets (buf, sizeof (buf), in)) {
+  while (fgets(buf, sizeof (buf), in)) {
     if (m_strncmp("From ", buf, 4) == 0 || buf[0] == ' ') {
       fputc (' ', out);
     }
     fputs (buf, out);
   }
-  fclose (in);
-  fclose (out);
+  m_fclose(&in);
+  m_fclose(&out);
   mutt_set_mtime (hdr->content->filename, tmpf);
   unlink (hdr->content->filename);
   m_strreplace(&hdr->content->filename, tmpf);