else
mutt_perror(fpin ? tempfile : a->filename);
- if (fpin)
- fclose (fpin);
- if (fpout)
- fclose (fpout);
+ m_fclose(&fpin);
+ m_fclose(&fpout);
return a->unlink ? 0 : -1;
}
goto bailout;
}
mutt_copy_stream (fp, tfp);
- fclose (fp);
- fclose (tfp);
+ m_fclose(&fp);
+ m_fclose(&tfp);
mutt_unlink (a->filename);
if (mutt_rename_file (tempfile, a->filename) != 0) {
mutt_perror (_("Failure to rename file."));
/* recv case */
m_strcpy(pagerfile, sizeof(pagerfile), a->filename);
mutt_adv_mktemp (NULL, pagerfile, sizeof (pagerfile));
- }
- else
+ } else {
mutt_mktemp (pagerfile);
+ }
}
if (use_mailcap) {
s.fpin = fp;
mutt_decode_attachment (b, &s);
- safe_fclose (&s.fpout);
+ m_fclose(&s.fpout);
}
else {
/* send case */
if (thepid < 0) {
mutt_perror (_("Can't create filter"));
- safe_fclose (&ifp);
+ m_fclose(&ifp);
goto bail;
}
mutt_copy_stream (ifp, ofp);
- safe_fclose (&ofp);
- safe_fclose (&ifp);
+ m_fclose(&ofp);
+ m_fclose(&ifp);
}
rv = 1;
fseeko ((s.fpin = fp), m->offset, 0);
mutt_decode_attachment (m, &s);
- if (fclose (s.fpout) != 0) {
+ if (m_fclose(&s.fpout) != 0) {
mutt_perror ("fclose");
return (-1);
}
}
- }
- else {
+ } else {
/* In send mode, just copy file */
FILE *ofp, *nfp;
if ((nfp = mutt_save_attachment_open (path, flags)) == NULL) {
mutt_perror ("fopen");
- safe_fclose (&ofp);
+ m_fclose(&ofp);
return (-1);
}
if (mutt_copy_stream (ofp, nfp) == -1) {
mutt_error _("Write fault!");
- safe_fclose (&ofp);
- safe_fclose (&nfp);
+ m_fclose(&ofp);
+ m_fclose(&nfp);
return (-1);
}
- safe_fclose (&ofp);
- safe_fclose (&nfp);
+ m_fclose(&ofp);
+ m_fclose(&nfp);
}
return 0;
if (stat (m->filename, &st) == -1) {
mutt_perror ("stat");
- fclose (s.fpout);
+ m_fclose(&s.fpout);
return (-1);
}
mutt_body_handler (m, &s);
- fclose (s.fpout);
+ m_fclose(&s.fpout);
if (fp == NULL) {
m->length = 0;
m->encoding = saved_encoding;
m->parts = saved_parts;
m->hdr = saved_hdr;
}
- fclose (s.fpin);
+ m_fclose(&s.fpin);
}
return (0);
mutt_perror (_("Can't create filter"));
rfc1524_entry_delete(&entry);
- safe_fclose (&ifp);
+ m_fclose(&ifp);
return 0;
}
mutt_copy_stream (ifp, fpout);
- safe_fclose (&fpout);
- safe_fclose (&ifp);
+ m_fclose(&fpout);
+ m_fclose(&ifp);
if (mutt_wait_filter (thepid) || option (OPTWAITKEY))
mutt_any_key_to_continue (NULL);
}
mutt_copy_stream (ifp, fpout);
- safe_fclose (&fpout);
- safe_fclose (&ifp);
+ m_fclose(&fpout);
+ m_fclose(&ifp);
if (mutt_wait_filter (thepid) != 0 || option (OPTWAITKEY))
mutt_any_key_to_continue (NULL);
rc = 1;
}
bail0:
- safe_fclose (&ifp);
- safe_fclose (&fpout);
+ m_fclose(&ifp);
+ m_fclose(&fpout);
mutt_unlink (newfile);
return rc;
}
p++;
}
}
- fclose (fp);
+ m_fclose(&fp);
return (found);
}