From: Kevin McCarthy Date: Fri, 28 Sep 2018 21:22:09 +0000 (-0700) Subject: Change imap_rename_mailbox to use a BUFFER. X-Git-Tag: mutt-1-11-rel~59 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a97543c35bcaa92876de749c6569a52ec9ed23dd;p=mutt Change imap_rename_mailbox to use a BUFFER. --- diff --git a/imap/imap.c b/imap/imap.c index 7104dbb1..ed70abf4 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -133,17 +133,22 @@ int imap_rename_mailbox (IMAP_DATA* idata, IMAP_MBOX* mx, const char* newname) { char oldmbox[LONG_STRING]; char newmbox[LONG_STRING]; - char buf[HUGE_STRING]; + BUFFER *b; + int rc = 0; imap_munge_mbox_name (idata, oldmbox, sizeof (oldmbox), mx->mbox); imap_munge_mbox_name (idata, newmbox, sizeof (newmbox), newname); - snprintf (buf, sizeof (buf), "RENAME %s %s", oldmbox, newmbox); + b = mutt_buffer_new (); + mutt_buffer_increase_size (b, LONG_STRING); + mutt_buffer_printf (b, "RENAME %s %s", oldmbox, newmbox); - if (imap_exec (idata, buf, 0) != 0) - return -1; + if (imap_exec (idata, b->data, 0) != 0) + rc = -1; - return 0; + mutt_buffer_free (&b); + + return rc; } int imap_delete_mailbox (CONTEXT* ctx, IMAP_MBOX mx)