Browse Source

avoid that a system crash can lose mails

this fixes two possible failure scenarios:
- if the journal is committed but the mails are not, the missing files
  would be erroneously interpreted as deletions which would be
  propagated
- less seriously, if the mail files' meta data was committed but the
  file contents were not, we would end up with empty files, which would
  have to be re-fetched "behind mbsync's back" (just deleting the files
  would not work - see above)
wip/maildir-uid-dupes-test
Oswald Buddenhagen 12 years ago
parent
commit
a326bf2f58
  1. 2
      src/drv_maildir.c

2
src/drv_maildir.c

@ -1204,7 +1204,7 @@ maildir_store_msg( store_t *gctx, msg_data_t *data, int to_trash,
}
ret = write( fd, data->data, data->len );
free( data->data );
if (ret != data->len) {
if (ret != data->len || (ret = fsync( fd ))) {
if (ret < 0)
sys_error( "Maildir error: cannot write %s", buf );
else

Loading…
Cancel
Save