From: Julien Danjou Date: Sat, 25 Nov 2006 17:10:47 +0000 (+0100) Subject: Use m_tempfile() X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=commitdiff_plain;h=9874228a8377de76c39f2eeb208d742fd4772ae5 Use m_tempfile() Signed-off-by: Julien Danjou Signed-off-by: Pierre Habouzit --- 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; }