projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Clean up code and use m_tempfile instead of mutt_mktemp
[apps/madmutt.git]
/
sendlib.c
diff --git
a/sendlib.c
b/sendlib.c
index
0324295
..
042ca3a
100644
(file)
--- a/
sendlib.c
+++ b/
sendlib.c
@@
-33,7
+33,7
@@
#endif /* USE_LIBESMTP */
#ifdef USE_NNTP
#endif /* USE_LIBESMTP */
#ifdef USE_NNTP
-#include <nntp.h>
+#include <nntp
/nntp
.h>
#endif
#ifdef HAVE_SYSEXITS_H
#endif
#ifdef HAVE_SYSEXITS_H
@@
-923,9
+923,9
@@
void mutt_message_to_7bit (BODY * a, FILE * fp)
a->length = sb.st_size;
}
a->length = sb.st_size;
}
-
mutt_mktemp (temp
);
- if (!
(fpout = safe_fopen (temp, "w+"))
) {
- mutt_
perror ("fopen"
);
+
fpout = m_tempfile(temp, sizeof(temp), NONULL(Tempdir), NULL
);
+ if (!
fpout
) {
+ mutt_
error(_("Could not create temporary file")
);
goto cleanup;
}
goto cleanup;
}
@@
-988,9
+988,9
@@
static void transform_to_7bit (BODY * a, FILE * fpin)
a->noconv = 1;
a->force_charset = 1;
a->noconv = 1;
a->force_charset = 1;
-
mutt_mktemp (buff
);
- if (
(s.fpout = safe_fopen (buff, "w")) == NULL
) {
- mutt_
perror ("fopen"
);
+
s.fpout = m_tempfile(buff, sizeof(buff), NONULL(Tempdir), NULL
);
+ if (
!s.fpout
) {
+ mutt_
error(_("Could not create temporary file")
);
return;
}
s.fpin = fpin;
return;
}
s.fpin = fpin;
@@
-2068,8
+2068,8
@@
static int _mutt_bounce_message (FILE * fp, HEADER * h, address_t * to,
if (!fp)
fp = msg->fp;
if (!fp)
fp = msg->fp;
-
mutt_mktemp (tempfile
);
- if (
(f = safe_fopen (tempfile, "w")) != NULL
) {
+
f = m_tempfile(tempfile, sizeof(tempfile), NONULL(Tempdir), NULL
);
+ if (
f
) {
int ch_flags = CH_XMIT | CH_NONEWLINE | CH_NOQFROM;
if (!option (OPTBOUNCEDELIVERED))
int ch_flags = CH_XMIT | CH_NONEWLINE | CH_NOQFROM;
if (!option (OPTBOUNCEDELIVERED))
@@
-2087,8
+2087,8
@@
static int _mutt_bounce_message (FILE * fp, HEADER * h, address_t * to,
mutt_copy_bytes (fp, f, h->content->length);
fclose (f);
mutt_copy_bytes (fp, f, h->content->length);
fclose (f);
- ret = mutt_invoke_mta
(env_from, to, NULL, NULL, tempfile,
-
h->content->encoding == ENC8BIT);
+ ret = mutt_invoke_mta(env_from, to, NULL, NULL, tempfile,
+ h->content->encoding == ENC8BIT);
}
if (msg)
}
if (msg)
@@
-2160,11
+2160,11
@@
int mutt_write_fcc (const char *path, HEADER * hdr, const char *msgid,
* the message body begins with "From "
*/
if (f.magic == M_MMDF || f.magic == M_MBOX) {
* the message body begins with "From "
*/
if (f.magic == M_MMDF || f.magic == M_MBOX) {
-
mutt_mktemp (tempfile
);
- if (
(tempfp = safe_fopen (tempfile, "w+")) == NULL
) {
- mutt_
perror (tempfile
);
+
tempfp = m_tempfile(tempfile, sizeof(tempfile), NONULL(Tempdir), NULL
);
+ if (
!tempfp
) {
+ mutt_
error(_("Could not create temporary file")
);
mx_close_mailbox (&f, NULL);
mx_close_mailbox (&f, NULL);
- return
(-1)
;
+ return
-1
;
}
}
}
}