isync

mailbox synchronization program
git clone https://git.code.sf.net/p/isync/isync
Log | Files | Refs | README | LICENSE

commit a326bf2f5890230fb31b982e39be9b80ad4fdecf
parent df6c3b64b75da7b278e6671e9b7965885c35b6ac
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date:   Sat, 15 Sep 2012 14:15:07 +0200

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)

Diffstat:
Msrc/drv_maildir.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/drv_maildir.c b/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