]> granicus.if.org Git - mutt/commitdiff
Display an error message if syncing fails.
authorKevin McCarthy <kevin@8t8.us>
Fri, 24 Aug 2018 19:56:54 +0000 (12:56 -0700)
committerKevin McCarthy <kevin@8t8.us>
Fri, 24 Aug 2018 19:56:54 +0000 (12:56 -0700)
Ticket 36 reported an issue where a maildir was removed while the
mailbox was opened.  Later, attempting to sync displayed the message
"Writing xxx...", which remained on the screen.  The reporter actually
thought mutt was frozen, but it was simply that on a sync error Mutt
wasn't clearing or updating the message window.

There is some error message handling for mbox.c check_mailbox, but I
don't think that is the right place to further propogate messages.
Instead, add an error to the same place the initial "Writing..."
message is created.

mx.c

diff --git a/mx.c b/mx.c
index 404daef9f47e12fa38bba0de325d5e1c66ad3c4c..9d311ef81277b39d95a5ac161a77073be3f4cbf3 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -729,13 +729,25 @@ void mx_fastclose_mailbox (CONTEXT *ctx)
 /* save changes to disk */
 static int sync_mailbox (CONTEXT *ctx, int *index_hint)
 {
+  int rc;
+
   if (!ctx->mx_ops || !ctx->mx_ops->sync)
     return -1;
 
   if (!ctx->quiet)
+  {
+    /* L10N: Displayed before/as a mailbox is being synced */
     mutt_message (_("Writing %s..."), ctx->path);
+  }
+
+  rc = ctx->mx_ops->sync (ctx, index_hint);
+  if (rc != 0 && !ctx->quiet)
+  {
+    /* L10N: Displayed if a mailbox sync fails */
+    mutt_error (_("Unable to write %s!"), ctx->path);
+  }
 
-  return ctx->mx_ops->sync (ctx, index_hint);
+  return rc;
 }
 
 /* move deleted mails to the trash folder */