]> granicus.if.org Git - mutt/commitdiff
Convert pgp_find_hash to use buffer pool.
authorKevin McCarthy <kevin@8t8.us>
Sun, 20 Oct 2019 07:52:22 +0000 (15:52 +0800)
committerKevin McCarthy <kevin@8t8.us>
Sun, 20 Oct 2019 07:52:22 +0000 (15:52 +0800)
pgpmicalg.c

index 2c7019d41c8b9c80a2deeed1f48417c0bd2c9ad3..07c9db5a6651e2cc3e1b08b4a850da1f4f1fbfa8 100644 (file)
@@ -162,21 +162,19 @@ static short pgp_find_hash (const char *fname)
 {
   FILE *in = NULL;
   FILE *out = NULL;
-
-  char tempfile[_POSIX_PATH_MAX];
-
+  BUFFER *tempfile = NULL;
   unsigned char *p;
   size_t l;
-
   short rv = -1;
 
-  mutt_mktemp (tempfile, sizeof (tempfile));
-  if ((out = safe_fopen (tempfile, "w+")) == NULL)
+  tempfile = mutt_buffer_pool_get ();
+  mutt_buffer_mktemp (tempfile);
+  if ((out = safe_fopen (mutt_b2s (tempfile), "w+")) == NULL)
   {
-    mutt_perror (tempfile);
+    mutt_perror (mutt_b2s (tempfile));
     goto bye;
   }
-  unlink (tempfile);
+  unlink (mutt_b2s (tempfile));
 
   if ((in = fopen (fname, "r")) == NULL)
   {
@@ -197,7 +195,7 @@ static short pgp_find_hash (const char *fname)
   }
 
 bye:
-
+  mutt_buffer_pool_release (&tempfile);
   safe_fclose (&in);
   safe_fclose (&out);
   pgp_release_packet ();