bool mime_fwd_any = true;
struct Email *e_parent = NULL;
FILE *fp_parent = NULL;
- char tmpbody[PATH_MAX];
char prefix[256];
enum QuadOption ans = MUTT_ABORT;
+ struct Buffer *tmpbody = NULL;
/* First, find the parent message.
* Note: This could be made an option by just
e_tmp->env = mutt_env_new();
mutt_make_forward_subject(e_tmp->env, Context->mailbox, e_parent);
- mutt_mktemp(tmpbody, sizeof(tmpbody));
- FILE *fp_tmp = mutt_file_fopen(tmpbody, "w");
+ tmpbody = mutt_buffer_pool_get();
+ mutt_buffer_mktemp(tmpbody);
+ FILE *fp_tmp = mutt_file_fopen(mutt_b2s(tmpbody), "w");
if (!fp_tmp)
{
- mutt_error(_("Can't open temporary file %s"), tmpbody);
+ mutt_error(_("Can't open temporary file %s"), mutt_b2s(tmpbody));
email_free(&e_tmp);
- return;
+ goto bail;
}
mutt_forward_intro(Context->mailbox, e_parent, fp_tmp);
/* now that we have the template, send it. */
struct EmailList el = STAILQ_HEAD_INITIALIZER(el);
el_add_email(&el, e_parent);
- ci_send_message(SEND_NO_FLAGS, e_tmp, tmpbody, NULL, &el);
+ ci_send_message(SEND_NO_FLAGS, e_tmp, mutt_b2s(tmpbody), NULL, &el);
emaillist_clear(&el);
+ mutt_buffer_pool_release(&tmpbody);
return;
bail:
-
if (fp_tmp)
{
mutt_file_fclose(&fp_tmp);
- mutt_file_unlink(tmpbody);
+ mutt_file_unlink(mutt_b2s(tmpbody));
}
+ mutt_buffer_pool_release(&tmpbody);
email_free(&e_tmp);
}