have_any_sigs = have_any_sigs || (clearsign && (s->flags & M_VERIFY));
/* Copy PGP material to temporary file */
- mutt_mktemp (tmpfname);
- if ((tmpfp = safe_fopen (tmpfname, "w+")) == NULL) {
+ tmpfp = m_tempfile(tmpfname, sizeof(tmpfname), NONULL(Tempdir), NULL);
+ if (tmpfp == NULL) {
mutt_perror (tmpfname);
return (-1);
}
/* Invoke PGP if needed */
if (!clearsign || (s->flags & M_VERIFY)) {
- mutt_mktemp (outfile);
- if ((pgpout = safe_fopen (outfile, "w+")) == NULL) {
- mutt_perror (tmpfname);
+ pgpout = m_tempfile(outfile, sizeof(outfile), NONULL(Tempdir), NULL);
+ if (pgpout == NULL) {
+ mutt_perror (outfile);
return (-1);
}
mutt_copy_bytes (s->fpin, fp, sigbdy->length);
fclose (fp);
- mutt_mktemp (pgperrfile);
- if (!(pgperr = safe_fopen (pgperrfile, "w+"))) {
+ pgperr = m_tempfile(pgperrfile, sizeof(pgperrfile), NONULL(Tempdir), NULL);
+ if (pgperr == NULL) {
mutt_perror (pgperrfile);
unlink (sigfile);
return -1;
FILE *tempfp;
char tempfname[_POSIX_PATH_MAX];
- mutt_mktemp (tempfname);
- if (!(tempfp = safe_fopen (tempfname, "w"))) {
+ tempfp = m_tempfile(tempfname, sizeof(tempfname), NONULL(Tempdir), NULL);
+ if (tempfp == NULL) {
mutt_perror (tempfname);
return;
}
pid_t thepid;
int rv;
- mutt_mktemp (pgperrfile);
- if ((pgperr = safe_fopen (pgperrfile, "w+")) == NULL) {
+ pgperr = m_tempfile(pgperrfile, sizeof(pgperrfile), NONULL(Tempdir), NULL);
+ if (pgperr == NULL) {
mutt_perror (pgperrfile);
return NULL;
}
unlink (pgperrfile);
- mutt_mktemp (pgptmpfile);
- if ((pgptmp = safe_fopen (pgptmpfile, "w")) == NULL) {
+ pgptmp = m_tempfile(pgptmpfile, sizeof(pgptmpfile), NONULL(Tempdir), NULL);
+ if (pgptmp == NULL) {
mutt_perror (pgptmpfile);
fclose (pgperr);
return NULL;
p_clear(&s, 1);
s.fpin = fpin;
- mutt_mktemp (tempfile);
- if ((*fpout = safe_fopen (tempfile, "w+")) == NULL) {
+ *fpout = m_tempfile(tempfile, sizeof(tempfile), NONULL(Tempdir), NULL);
+ if (*fpout == NULL) {
mutt_perror (tempfile);
return (-1);
}
*/
a = a->next;
- mutt_mktemp (tempfile);
- if ((fpout = safe_fopen (tempfile, "w+")) == NULL) {
+ fpout = m_tempfile(tempfile, sizeof(tempfile), NONULL(Tempdir), NULL);
+ if (fpout == NULL) {
if (s->flags & M_DISPLAY)
state_attach_puts (_
("[-- Error: could not create temporary file! --]\n"),
convert_to_7bit (a); /* Signed data _must_ be in 7-bit format. */
- mutt_mktemp (sigfile);
- if ((fp = safe_fopen (sigfile, "w")) == NULL) {
+ fp = m_tempfile(sigfile, sizeof(sigfile), NONULL(Tempdir), NULL);
+ if (fp == NULL) {
return (NULL);
}
- mutt_mktemp (signedfile);
- if ((sfp = safe_fopen (signedfile, "w")) == NULL) {
+ sfp = m_tempfile(signedfile, sizeof(signedfile), NONULL(Tempdir), NULL);
+ if (sfp == NULL) {
mutt_perror (signedfile);
fclose (fp);
unlink (sigfile);
int empty = 0;
pid_t thepid;
- mutt_mktemp (tempfile);
- if ((fpout = safe_fopen (tempfile, "w+")) == NULL) {
+ fpout = m_tempfile(tempfile, sizeof(tempfile), NONULL(Tempdir), NULL);
+ if (fpout == NULL) {
mutt_perror (tempfile);
return (NULL);
}
- mutt_mktemp (pgperrfile);
- if ((pgperr = safe_fopen (pgperrfile, "w+")) == NULL) {
+ pgperr = m_tempfile(pgperrfile, sizeof(pgperrfile), NONULL(Tempdir), NULL);
+ if (pgperr == NULL) {
mutt_perror (pgperrfile);
- unlink (tempfile);
fclose (fpout);
+ unlink (tempfile);
return NULL;
}
unlink (pgperrfile);
- mutt_mktemp (pgpinfile);
- if ((fptmp = safe_fopen (pgpinfile, "w")) == NULL) {
+ fptmp = m_tempfile(pgpinfile, sizeof(pgpinfile), NONULL(Tempdir), NULL);
+ if (fptmp == NULL) {
mutt_perror (pgpinfile);
- unlink (tempfile);
fclose (fpout);
+ unlink (tempfile);
fclose (pgperr);
+ unlink (pgperrfile);
return NULL;
}
return NULL;
}
- mutt_mktemp (pgpinfile);
- if ((pgpin = safe_fopen (pgpinfile, "w")) == NULL) {
+ pgpin = m_tempfile(pgpinfile, sizeof(pgpinfile), NONULL(Tempdir), NULL);
+ if (pgpin == NULL) {
mutt_perror (pgpinfile);
fclose (fp);
return NULL;
safe_fclose (&fp);
fclose (pgpin);
- mutt_mktemp (pgpoutfile);
- mutt_mktemp (pgperrfile);
- if ((pgpout = safe_fopen (pgpoutfile, "w+")) == NULL ||
- (pgperr = safe_fopen (pgperrfile, "w+")) == NULL) {
+ pgpout = m_tempfile(pgpoutfile, sizeof(pgpoutfile), NONULL(Tempdir), NULL);
+ pgperr = m_tempfile(pgperrfile, sizeof(pgperrfile), NONULL(Tempdir), NULL);
+ if (pgpout == NULL || pgperr == NULL) {
mutt_perror (pgpout ? pgperrfile : pgpoutfile);
+ fclose (pgpin);
unlink (pgpinfile);
if (pgpout) {
fclose (pgpout);