mutt stable branch with some hacks
0
fork

Configure Feed

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

Use a different flag in mx_open_mailbox_append() when mailbox doesn't exist.

The previous commit re-used MUTT_NEWFOLDER, but the meaning of that
flag is slightly different: it causes mbox to use fopen with mode "w",
and is used only for the case of a brand-new mktemp-generated mbox.

Setting it for other non-existing mbox files leads to a race condition
between the stat and the fopen/lock, and so could end up truncating an
existing mailbox created in-between!

Create a different flag, MUTT_APPENDNEW to notify the open_append()
functions that the mailbox doesn't exist. Change maildir and mh to
check for that flag to create their directory structures.

+7 -4
+4 -1
mailbox.h
··· 25 25 #define MUTT_READONLY (1<<2) /* open in read-only mode */ 26 26 #define MUTT_QUIET (1<<3) /* do not print any messages */ 27 27 #define MUTT_NEWFOLDER (1<<4) /* create a new folder - same as MUTT_APPEND, but uses 28 - * safe_fopen() for mbox-style folders. */ 28 + * safe_fopen() with mode "w" for mbox-style folders. 29 + * This will truncate an existing file. */ 29 30 #define MUTT_PEEK (1<<5) /* revert atime back after taking a look (if applicable) */ 31 + #define MUTT_APPENDNEW (1<<6) /* set in mx_open_mailbox_append if the mailbox doesn't 32 + * exist. used by maildir/mh to create the mailbox. */ 30 33 31 34 /* mx_open_new_message() */ 32 35 #define MUTT_ADD_FROM (1<<0) /* add a From_ line */
+2 -2
mh.c
··· 1294 1294 { 1295 1295 char tmp[_POSIX_PATH_MAX]; 1296 1296 1297 - if (flags & MUTT_NEWFOLDER) 1297 + if (flags & MUTT_APPENDNEW) 1298 1298 { 1299 1299 if (mkdir (ctx->path, S_IRWXU)) 1300 1300 { ··· 1346 1346 char tmp[_POSIX_PATH_MAX]; 1347 1347 int i; 1348 1348 1349 - if (flags & MUTT_NEWFOLDER) 1349 + if (flags & MUTT_APPENDNEW) 1350 1350 { 1351 1351 if (mkdir (ctx->path, S_IRWXU)) 1352 1352 {
+1 -1
mx.c
··· 495 495 if (errno == ENOENT) 496 496 { 497 497 ctx->magic = DefaultMagic; 498 - flags |= MUTT_NEWFOLDER; 498 + flags |= MUTT_APPENDNEW; 499 499 } 500 500 else 501 501 {