mutt stable branch with some hacks
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Convert pop_fetch_message() to use buffer pool.

+19 -13
+19 -13
pop.c
··· 544 544 /* fetch message from POP server */ 545 545 static int pop_fetch_message (CONTEXT* ctx, MESSAGE* msg, int msgno) 546 546 { 547 - int ret; 547 + int ret, rc = -1; 548 548 void *uidl; 549 549 char buf[LONG_STRING]; 550 - char path[_POSIX_PATH_MAX]; 550 + BUFFER *path = NULL; 551 551 progress_t progressbar; 552 552 POP_DATA *pop_data = (POP_DATA *)ctx->data; 553 553 POP_CACHE *cache; ··· 585 585 } 586 586 } 587 587 588 + path = mutt_buffer_pool_get (); 589 + 588 590 FOREVER 589 591 { 590 592 if (pop_reconnect (ctx) < 0) 591 - return -1; 593 + goto cleanup; 592 594 593 595 /* verify that massage index is correct */ 594 596 if (h->refno < 0) 595 597 { 596 598 mutt_error _("The message index is incorrect. Try reopening the mailbox."); 597 599 mutt_sleep (2); 598 - return -1; 600 + goto cleanup; 599 601 } 600 602 601 603 mutt_progress_init (&progressbar, _("Fetching message..."), ··· 606 608 { 607 609 /* no */ 608 610 bcache = 0; 609 - mutt_mktemp (path, sizeof (path)); 610 - if (!(msg->fp = safe_fopen (path, "w+"))) 611 + mutt_buffer_mktemp (path); 612 + if (!(msg->fp = safe_fopen (mutt_b2s (path), "w+"))) 611 613 { 612 - mutt_perror (path); 614 + mutt_perror (mutt_b2s (path)); 613 615 mutt_sleep (2); 614 - return -1; 616 + goto cleanup; 615 617 } 616 618 } 617 619 ··· 627 629 * the file in bcache or from POP's own cache since the next iteration 628 630 * of the loop will re-attempt to put() the message */ 629 631 if (!bcache) 630 - unlink (path); 632 + unlink (mutt_b2s (path)); 631 633 632 634 if (ret == -2) 633 635 { 634 636 mutt_error ("%s", pop_data->err_msg); 635 637 mutt_sleep (2); 636 - return -1; 638 + goto cleanup; 637 639 } 638 640 639 641 if (ret == -3) 640 642 { 641 643 mutt_error _("Can't write message to temporary file!"); 642 644 mutt_sleep (2); 643 - return -1; 645 + goto cleanup; 644 646 } 645 647 } 646 648 ··· 652 654 else 653 655 { 654 656 cache->index = h->index; 655 - cache->path = safe_strdup (path); 657 + cache->path = safe_strdup (mutt_b2s (path)); 656 658 } 657 659 rewind (msg->fp); 658 660 uidl = h->data; ··· 685 687 mutt_clear_error(); 686 688 rewind (msg->fp); 687 689 688 - return 0; 690 + rc = 0; 691 + 692 + cleanup: 693 + mutt_buffer_pool_release (&path); 694 + return rc; 689 695 } 690 696 691 697 static int pop_close_message (CONTEXT *ctx, MESSAGE *msg)