]> granicus.if.org Git - neomutt/commitdiff
Change imap_rename_mailbox to use a BUFFER.
authorKevin McCarthy <kevin@8t8.us>
Fri, 28 Sep 2018 21:22:09 +0000 (14:22 -0700)
committerRichard Russon <rich@flatcap.org>
Mon, 1 Oct 2018 22:19:43 +0000 (23:19 +0100)
imap/imap.c

index 2e2a4c8c47f755f166f9629726130a40b1693dc9..642f8ee84a28e86678a7603c1a0e1ba122f0c29f 100644 (file)
@@ -690,17 +690,20 @@ int imap_rename_mailbox(struct ImapMboxData *mdata, struct ImapMbox *mx, const c
 {
   char oldmbox[LONG_STRING];
   char newmbox[LONG_STRING];
-  char buf[HUGE_STRING];
+  int rc = 0;
 
   imap_munge_mbox_name(mdata, oldmbox, sizeof(oldmbox), mx->mbox);
   imap_munge_mbox_name(mdata, newmbox, sizeof(newmbox), newname);
 
-  snprintf(buf, sizeof(buf), "RENAME %s %s", oldmbox, newmbox);
+  struct Buffer *b = mutt_buffer_alloc(LONG_STRING);
+  mutt_buffer_printf(b, "RENAME %s %s", oldmbox, newmbox);
 
-  if (imap_exec(mdata, buf, 0) != 0)
-    return -1;
+  if (imap_exec(mdata, b->data, 0) != 0)
+    rc = -1;
 
-  return 0;
+  mutt_buffer_free(&b);
+
+  return rc;
 }
 
 /**