X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=mbox.c;h=1cd5a0c9a8083792dd45628cb621e9ab62340de8;hp=d3ecea59b190a277cc3fb2ba604bf1913d8fa7bb;hb=afa60149c4d2bb71c8195091d3658b3bdc12d59d;hpb=a9d22903ab440da5d0b4d994d9de49ff2cf663d4 diff --git a/mbox.c b/mbox.c index d3ecea5..1cd5a0c 100644 --- a/mbox.c +++ b/mbox.c @@ -564,6 +564,8 @@ static int _mbox_sync_mailbox (CONTEXT * ctx, int unused, int *index_hint) save_sort = Sort; Sort = SORT_ORDER; mutt_sort_headers (ctx, 0); + Sort = save_sort; + need_sort = 1; } /* need to open the file for writing in such a way that it does not truncate @@ -593,11 +595,9 @@ static int _mbox_sync_mailbox (CONTEXT * ctx, int unused, int *index_hint) rc = i; goto bail; } - else if (i < 0) { + else if (i < 0) /* fatal error */ - Sort = save_sort; return (-1); - } /* Create a temporary file to write the new version of the mailbox in. */ mutt_mktemp (tempfile); @@ -811,8 +811,6 @@ static int _mbox_sync_mailbox (CONTEXT * ctx, int unused, int *index_hint) mutt_unblock_signals (); mx_fastclose_mailbox (ctx); mutt_error _("Fatal error! Could not reopen mailbox!"); - - Sort = save_sort; return (-1); } @@ -829,7 +827,6 @@ static int _mbox_sync_mailbox (CONTEXT * ctx, int unused, int *index_hint) FREE (&oldOffset); unlink (tempfile); /* remove partial copy of the mailbox */ mutt_unblock_signals (); - Sort = save_sort; /* Restore the default value. */ return (0); /* signal success */ @@ -862,12 +859,10 @@ bail: /* Come here in case of disaster */ return (-1); } - if (need_sort || save_sort != Sort) { - Sort = save_sort; + if (need_sort) /* if the mailbox was reopened, the thread tree will be invalid so make * sure to start threading from scratch. */ mutt_sort_headers (ctx, (need_sort == M_REOPENED)); - } return rc; }