summaryrefslogtreecommitdiffstats
path: root/pgp.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2019-10-18 14:29:56 +0800
committerKevin McCarthy <kevin@8t8.us>2019-10-18 14:29:56 +0800
commitf3bfb7d105854f53428b98de95d920e6f5ebad0e (patch)
treecb9df34d57f99d2cb5d8d7f0810626806cd7ddfe /pgp.c
parente27225519f79bdd50299fd209abd93a218d95ba3 (diff)
Convert pgp_extract_keys_from_attachment() to use buffer pool.
Diffstat (limited to 'pgp.c')
-rw-r--r--pgp.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/pgp.c b/pgp.c
index dd23cb74..c10c7bbf 100644
--- a/pgp.c
+++ b/pgp.c
@@ -884,13 +884,14 @@ static void pgp_extract_keys_from_attachment (FILE *fp, BODY *top)
{
STATE s;
FILE *tempfp;
- char tempfname[_POSIX_PATH_MAX];
+ BUFFER *tempfname = NULL;
- mutt_mktemp (tempfname, sizeof (tempfname));
- if (!(tempfp = safe_fopen (tempfname, "w")))
+ tempfname = mutt_buffer_pool_get ();
+ mutt_buffer_mktemp (tempfname);
+ if (!(tempfp = safe_fopen (mutt_b2s (tempfname), "w")))
{
- mutt_perror (tempfname);
- return;
+ mutt_perror (mutt_b2s (tempfname));
+ goto cleanup;
}
memset (&s, 0, sizeof (STATE));
@@ -902,10 +903,13 @@ static void pgp_extract_keys_from_attachment (FILE *fp, BODY *top)
safe_fclose (&tempfp);
- pgp_invoke_import (tempfname);
+ pgp_invoke_import (mutt_b2s (tempfname));
mutt_any_key_to_continue (NULL);
- mutt_unlink (tempfname);
+ mutt_unlink (mutt_b2s (tempfname));
+
+cleanup:
+ mutt_buffer_pool_release (&tempfname);
}
void pgp_extract_keys_from_attachment_list (FILE *fp, int tag, BODY *top)