]> granicus.if.org Git - mutt/commitdiff
Convert print_attachment_list to use buffer pool.
authorKevin McCarthy <kevin@8t8.us>
Thu, 12 Sep 2019 02:47:13 +0000 (19:47 -0700)
committerKevin McCarthy <kevin@8t8.us>
Fri, 13 Sep 2019 22:15:41 +0000 (15:15 -0700)
recvattach.c

index 9b00eeb8f03617c85943cac73565e24e19d373a4..1c3dddd16170816e2b5bcaf978d3caf453c9973d 100644 (file)
@@ -789,13 +789,15 @@ static void print_attachment_list (ATTACH_CONTEXT *actx, FILE *fp, int tag, BODY
        {
          /* decode and print */
 
-         char newfile[_POSIX_PATH_MAX] = "";
+         BUFFER *newfile = NULL;
          FILE *ifp;
 
-         mutt_mktemp (newfile, sizeof (newfile));
-         if (mutt_decode_save_attachment (fp, top, newfile, MUTT_PRINTING, 0) == 0)
+          newfile = mutt_buffer_pool_get ();
+         mutt_buffer_mktemp (newfile);
+         if (mutt_decode_save_attachment (fp, top, mutt_b2s (newfile),
+                                           MUTT_PRINTING, 0) == 0)
          {
-           if ((ifp = fopen (newfile, "r")) != NULL)
+           if ((ifp = fopen (mutt_b2s (newfile), "r")) != NULL)
            {
              mutt_copy_stream (ifp, state->fpout);
              safe_fclose (&ifp);
@@ -803,7 +805,8 @@ static void print_attachment_list (ATTACH_CONTEXT *actx, FILE *fp, int tag, BODY
                state_puts (AttachSep, state);
            }
          }
-         mutt_unlink (newfile);
+         mutt_unlink (mutt_b2s (newfile));
+          mutt_buffer_pool_release (&newfile);
        }
       }
       else