From 9874228a8377de76c39f2eeb208d742fd4772ae5 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Sat, 25 Nov 2006 18:10:47 +0100 Subject: [PATCH] Use m_tempfile() Signed-off-by: Julien Danjou Signed-off-by: Pierre Habouzit --- lib-crypt/pgpkey.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib-crypt/pgpkey.c b/lib-crypt/pgpkey.c index a3b3ca2..16d9e4c 100644 --- a/lib-crypt/pgpkey.c +++ b/lib-crypt/pgpkey.c @@ -500,13 +500,14 @@ static pgp_key_t pgp_select_key (pgp_key_t keys, address_t * p, const char *s) case OP_VERIFY_KEY: - mutt_mktemp (tempfile); if ((devnull = fopen ("/dev/null", "w")) == NULL) { /* __FOPEN_CHECKED__ */ mutt_perror (_("Can't open /dev/null")); break; } - if ((fp = safe_fopen (tempfile, "w")) == NULL) { + + fp = m_tempfile (tempfile, sizeof(tempfile), NONULL(Tempdir), NULL); + if (!fp) { m_fclose(&devnull); mutt_perror (_("Can't create temporary file")); @@ -682,13 +683,14 @@ BODY *pgp_make_key_attachment (char *tempf) pgp_free_key (&key); if (!tempf) { - mutt_mktemp (tempfb); + tempfp = m_tempfile (tempfb, sizeof(tempfb), NONULL(Tempdir), NULL); tempf = tempfb; + } else { + tempfp = safe_fopen(tempf, "a"); } - if ((tempfp = safe_fopen (tempf, tempf == tempfb ? "w" : "a")) == NULL) { + if (!tempfp) { mutt_perror (_("Can't create temporary file")); - return NULL; } -- 2.20.1