diff options
author | Kevin McCarthy <kevin@8t8.us> | 2019-10-19 14:48:17 +0800 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2019-10-19 14:48:17 +0800 |
commit | 48a343779d748e7e4893f53bdb49e5d24734b0a2 (patch) | |
tree | 456d8d7d2f3bf41147b4d5bfe84ee2bbb3a8c42e /pgp.c | |
parent | aa66b4145b073484f5f26382e34b5d6d10455744 (diff) |
Convert pgp_encrypted_handler() to use buffer pool.
Diffstat (limited to 'pgp.c')
-rw-r--r-- | pgp.c | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -1150,17 +1150,18 @@ bail: */ int pgp_encrypted_handler (BODY *a, STATE *s) { - char tempfile[_POSIX_PATH_MAX]; + BUFFER *tempfile = NULL; FILE *fpout, *fpin; BODY *tattach; - int rc = 0; + int rc = -1; - mutt_mktemp (tempfile, sizeof (tempfile)); - if ((fpout = safe_fopen (tempfile, "w+")) == NULL) + tempfile = mutt_buffer_pool_get (); + mutt_buffer_mktemp (tempfile); + if ((fpout = safe_fopen (mutt_b2s (tempfile), "w+")) == NULL) { if (s->flags & MUTT_DISPLAY) state_attach_puts (_("[-- Error: could not create temporary file! --]\n"), s); - return -1; + goto cleanup; } if (s->flags & MUTT_DISPLAY) crypt_current_time (s, "PGP"); @@ -1225,12 +1226,13 @@ int pgp_encrypted_handler (BODY *a, STATE *s) mutt_sleep (2); /* void the passphrase, even if it's not necessarily the problem */ pgp_void_passphrase (); - rc = -1; } safe_fclose (&fpout); - mutt_unlink(tempfile); + mutt_unlink (mutt_b2s (tempfile)); +cleanup: + mutt_buffer_pool_release (&tempfile); return rc; } |